org.apache.openejb.loader.IO类的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(203)

本文整理了Java中org.apache.openejb.loader.IO类的一些代码示例,展示了IO类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IO类的具体详情如下:
包路径:org.apache.openejb.loader.IO
类名称:IO

IO介绍

暂无

代码示例

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static void copy(final File from, final OutputStream to) throws IOException {
  2. final InputStream read = read(from);
  3. try {
  4. copy(read, to);
  5. } finally {
  6. close(read);
  7. }
  8. }

代码示例来源:origin: org.apache.tomee/openejb-server

  1. private String readContents(final URL resource) throws IOException {
  2. return IO.slurp(resource);
  3. }

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static Properties readProperties(final File resource, final Properties properties) throws IOException {
  2. return readProperties(read(resource), properties);
  3. }

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static void copy(final InputStream from, final File to) throws IOException {
  2. final OutputStream write = write(to);
  3. try {
  4. copy(from, write);
  5. } finally {
  6. close(write);
  7. }
  8. }

代码示例来源:origin: org.apache.tomee/openejb-loader

  1. public static String slurp(final File file) throws IOException {
  2. try (final InputStream is = read(file)) {
  3. return slurp(is);
  4. }
  5. }

代码示例来源:origin: com.tomitribe.tribestream/tribestream-api-gateway-backbone

  1. private static void updateBinFile(final File binDir, final String binFile, final String changes) throws IOException {
  2. final URL agent = getResource(changes);
  3. final File catalinaSh = file(binDir, binFile);
  4. String content = IO.slurp(catalinaSh);
  5. content = content.replace("# ----- Execute The Requested Command", IO.slurp(agent));
  6. IO.copy(IO.read(content), catalinaSh);
  7. }

代码示例来源:origin: org.apache.openejb/openejb-core

  1. private void writeRaXml(final ConnectorModule connectorModule) {
  2. try {
  3. final Connector connector = connectorModule.getConnector();
  4. final File tempFile = tempFile("ra-", connectorModule.getModuleId() + ".xml");
  5. final OutputStream out = IO.write(tempFile);
  6. try {
  7. final JAXBContext ctx = JAXBContextFactory.newInstance(Connector.class);
  8. final Marshaller marshaller = ctx.createMarshaller();
  9. marshaller.marshal(connector, out);
  10. logger.info("Dumping Generated ra.xml to: " + tempFile.getAbsolutePath());
  11. } catch (final JAXBException e) {
  12. // no-op
  13. } finally {
  14. IO.close(out);
  15. }
  16. } catch (final IOException e) {
  17. // no-op
  18. }
  19. }

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static void copy(final File from, final File to) throws IOException {
  2. if (!from.isDirectory()) {
  3. final FileOutputStream fos = new FileOutputStream(to);
  4. try {
  5. copy(from, fos);
  6. } finally {
  7. close(fos);
  8. }
  9. } else {
  10. copyDirectory(from, to);
  11. }
  12. }

代码示例来源:origin: com.tomitribe.tribestream/tribestream-api-gateway-backbone

  1. private static void installResource(final File conf, final String file) throws IOException {
  2. final URL resource = getResource("/" + file);
  3. IO.copy(IO.read(resource), IO.write(new File(conf, file)));
  4. }

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static String copyTryingProxies(final URI source, final File destination) throws Exception {
  2. final InputStream is = inputStreamTryingProxies(source);
  3. if (is == null) {
  4. return null;
  5. }
  6. try {
  7. IO.copy(is, destination);
  8. } finally {
  9. IO.close(is);
  10. }
  11. return destination.getAbsolutePath();
  12. }

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static String readString(final File file) throws IOException {
  2. final FileReader in = new FileReader(file);
  3. try {
  4. final BufferedReader reader = new BufferedReader(in);
  5. return reader.readLine();
  6. } finally {
  7. close(in);
  8. }
  9. }

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. private static File copy(final File file, final File lib) throws IOException {
  2. final File dest = new File(lib, file.getName());
  3. if (dest.exists()) {
  4. return dest;
  5. }
  6. IO.copy(file, dest);
  7. return dest;
  8. }

代码示例来源:origin: org.apache.openejb/openejb-core

  1. private void installLoggingPropertiesFile(final File loggingPropertiesFile) throws IOException {
  2. final String name = STANDALONE_PROPERTIES_FILE + LOGGING_PROPERTIES_FILE;
  3. final URL resource = Thread.currentThread().getContextClassLoader().getResource(name);
  4. if (resource == null) {
  5. System.err.println("FATAL ERROR WHILE CONFIGURING LOGGING!!!. MISSING RESOURCE " + name);
  6. return;
  7. }
  8. final Properties props = IO.readProperties(resource);
  9. preprocessProperties(props);
  10. final OutputStream out = IO.write(loggingPropertiesFile);
  11. try {
  12. props.store(out, "OpenEJB Default Log4j Configuration");
  13. } finally {
  14. IO.close(out);
  15. }
  16. PropertyConfigurator.configure(props);
  17. }
  18. }

代码示例来源:origin: org.apache.tomee/openejb-core

  1. public static File createConfig(final File config) throws IOException {
  2. final ResourceFinder finder = new ResourceFinder("");
  3. final URL defaultConfig = finder.find("default.openejb.conf");
  4. IO.copy(IO.read(defaultConfig), config);
  5. return config;
  6. }

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static void unzip(final File zipFile, final File destination, final boolean noparent) throws IOException {
  2. Files.dir(destination);
  3. Files.writable(destination);
  4. Files.file(zipFile);
  5. Files.readable(zipFile);
  6. final InputStream read = IO.read(zipFile);
  7. try {
  8. unzip(read, destination, noparent);
  9. } finally {
  10. IO.close(read);
  11. }
  12. }

代码示例来源:origin: org.apache.tomee/openejb-server

  1. private Properties loadProperties(final URL resource) throws IOException {
  2. return IO.readProperties(resource);
  3. }

代码示例来源:origin: com.tomitribe.tribestream/tribestream

  1. private static void rename(final File directory, final String from, final String to) throws IOException {
  2. System.out.println(String.format("Renaming %s to %s in directory %s", from, to, directory));
  3. if (!new File(directory, from).renameTo(new File(directory, to))) {
  4. IO.copy(new File(directory, from), new File(directory, to));
  5. IO.delete(new File(directory, from));
  6. }
  7. }

代码示例来源:origin: org.apache.openejb/openejb-core

  1. @Override
  2. public InputStream get() throws IOException {
  3. return IO.read(url);
  4. }
  5. }

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static ZipOutputStream zip(final File file) throws IOException {
  2. final OutputStream write = write(file);
  3. return new ZipOutputStream(write);
  4. }

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static void copy(final InputStream from, final File to, final boolean append) throws IOException {
  2. final OutputStream write = write(to, append);
  3. try {
  4. copy(from, write);
  5. } finally {
  6. close(write);
  7. }
  8. }

相关文章