本文整理了Java中org.apache.openejb.loader.IO
类的一些代码示例,展示了IO
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IO
类的具体详情如下:
包路径:org.apache.openejb.loader.IO
类名称:IO
暂无
代码示例来源:origin: org.apache.openejb/openejb-loader
public static void copy(final File from, final OutputStream to) throws IOException {
final InputStream read = read(from);
try {
copy(read, to);
} finally {
close(read);
}
}
代码示例来源:origin: org.apache.tomee/openejb-server
private String readContents(final URL resource) throws IOException {
return IO.slurp(resource);
}
代码示例来源:origin: org.apache.openejb/openejb-loader
public static Properties readProperties(final File resource, final Properties properties) throws IOException {
return readProperties(read(resource), properties);
}
代码示例来源:origin: org.apache.openejb/openejb-loader
public static void copy(final InputStream from, final File to) throws IOException {
final OutputStream write = write(to);
try {
copy(from, write);
} finally {
close(write);
}
}
代码示例来源:origin: org.apache.tomee/openejb-loader
public static String slurp(final File file) throws IOException {
try (final InputStream is = read(file)) {
return slurp(is);
}
}
代码示例来源:origin: com.tomitribe.tribestream/tribestream-api-gateway-backbone
private static void updateBinFile(final File binDir, final String binFile, final String changes) throws IOException {
final URL agent = getResource(changes);
final File catalinaSh = file(binDir, binFile);
String content = IO.slurp(catalinaSh);
content = content.replace("# ----- Execute The Requested Command", IO.slurp(agent));
IO.copy(IO.read(content), catalinaSh);
}
代码示例来源:origin: org.apache.openejb/openejb-core
private void writeRaXml(final ConnectorModule connectorModule) {
try {
final Connector connector = connectorModule.getConnector();
final File tempFile = tempFile("ra-", connectorModule.getModuleId() + ".xml");
final OutputStream out = IO.write(tempFile);
try {
final JAXBContext ctx = JAXBContextFactory.newInstance(Connector.class);
final Marshaller marshaller = ctx.createMarshaller();
marshaller.marshal(connector, out);
logger.info("Dumping Generated ra.xml to: " + tempFile.getAbsolutePath());
} catch (final JAXBException e) {
// no-op
} finally {
IO.close(out);
}
} catch (final IOException e) {
// no-op
}
}
代码示例来源:origin: org.apache.openejb/openejb-loader
public static void copy(final File from, final File to) throws IOException {
if (!from.isDirectory()) {
final FileOutputStream fos = new FileOutputStream(to);
try {
copy(from, fos);
} finally {
close(fos);
}
} else {
copyDirectory(from, to);
}
}
代码示例来源:origin: com.tomitribe.tribestream/tribestream-api-gateway-backbone
private static void installResource(final File conf, final String file) throws IOException {
final URL resource = getResource("/" + file);
IO.copy(IO.read(resource), IO.write(new File(conf, file)));
}
代码示例来源:origin: org.apache.openejb/openejb-loader
public static String copyTryingProxies(final URI source, final File destination) throws Exception {
final InputStream is = inputStreamTryingProxies(source);
if (is == null) {
return null;
}
try {
IO.copy(is, destination);
} finally {
IO.close(is);
}
return destination.getAbsolutePath();
}
代码示例来源:origin: org.apache.openejb/openejb-loader
public static String readString(final File file) throws IOException {
final FileReader in = new FileReader(file);
try {
final BufferedReader reader = new BufferedReader(in);
return reader.readLine();
} finally {
close(in);
}
}
代码示例来源:origin: org.apache.openejb/openejb-loader
private static File copy(final File file, final File lib) throws IOException {
final File dest = new File(lib, file.getName());
if (dest.exists()) {
return dest;
}
IO.copy(file, dest);
return dest;
}
代码示例来源:origin: org.apache.openejb/openejb-core
private void installLoggingPropertiesFile(final File loggingPropertiesFile) throws IOException {
final String name = STANDALONE_PROPERTIES_FILE + LOGGING_PROPERTIES_FILE;
final URL resource = Thread.currentThread().getContextClassLoader().getResource(name);
if (resource == null) {
System.err.println("FATAL ERROR WHILE CONFIGURING LOGGING!!!. MISSING RESOURCE " + name);
return;
}
final Properties props = IO.readProperties(resource);
preprocessProperties(props);
final OutputStream out = IO.write(loggingPropertiesFile);
try {
props.store(out, "OpenEJB Default Log4j Configuration");
} finally {
IO.close(out);
}
PropertyConfigurator.configure(props);
}
}
代码示例来源:origin: org.apache.tomee/openejb-core
public static File createConfig(final File config) throws IOException {
final ResourceFinder finder = new ResourceFinder("");
final URL defaultConfig = finder.find("default.openejb.conf");
IO.copy(IO.read(defaultConfig), config);
return config;
}
代码示例来源:origin: org.apache.openejb/openejb-loader
public static void unzip(final File zipFile, final File destination, final boolean noparent) throws IOException {
Files.dir(destination);
Files.writable(destination);
Files.file(zipFile);
Files.readable(zipFile);
final InputStream read = IO.read(zipFile);
try {
unzip(read, destination, noparent);
} finally {
IO.close(read);
}
}
代码示例来源:origin: org.apache.tomee/openejb-server
private Properties loadProperties(final URL resource) throws IOException {
return IO.readProperties(resource);
}
代码示例来源:origin: com.tomitribe.tribestream/tribestream
private static void rename(final File directory, final String from, final String to) throws IOException {
System.out.println(String.format("Renaming %s to %s in directory %s", from, to, directory));
if (!new File(directory, from).renameTo(new File(directory, to))) {
IO.copy(new File(directory, from), new File(directory, to));
IO.delete(new File(directory, from));
}
}
代码示例来源:origin: org.apache.openejb/openejb-core
@Override
public InputStream get() throws IOException {
return IO.read(url);
}
}
代码示例来源:origin: org.apache.openejb/openejb-loader
public static ZipOutputStream zip(final File file) throws IOException {
final OutputStream write = write(file);
return new ZipOutputStream(write);
}
代码示例来源:origin: org.apache.openejb/openejb-loader
public static void copy(final InputStream from, final File to, final boolean append) throws IOException {
final OutputStream write = write(to, append);
try {
copy(from, write);
} finally {
close(write);
}
}
内容来源于网络,如有侵权,请联系作者删除!