org.apache.openejb.loader.IO.close()方法的使用及代码示例

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

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

IO.close介绍

暂无

代码示例

代码示例来源: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.tomee/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.tomee/openejb-loader

public static String readString(final URL url) throws IOException {
  final InputStream in = url.openStream();
  try {
    final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
    return reader.readLine();
  } finally {
    close(in);
  }
}

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

public static String readString(final URL url) throws IOException {
  final InputStream in = url.openStream();
  try {
    final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
    return reader.readLine();
  } finally {
    close(in);
  }
}

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

public static void jarDir(final File dir, final File zipName) throws IOException, IllegalArgumentException {
  final String[] entries = dir.list();
  final JarOutputStream out = new JarOutputStream(new FileOutputStream(zipName));
  String prefix = dir.getAbsolutePath();
  if (!prefix.endsWith(File.separator)) {
    prefix += File.separator;
  }
  for (final String entry : entries) {
    final File f = new File(dir, entry);
    jarFile(out, f, prefix);
  }
  IO.close(out);
}

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

private void internalProcessAnnotationsStream(final Collection<String> urls, final WebXml fragment,
                       final boolean handlesTypeOnly) {
  for (final String url : urls) {
    InputStream is = null;
    try {
      is = new URL(url).openStream();
      super.processAnnotationsStream(is, fragment, handlesTypeOnly, EMPTY_MAP);
    } catch (final IOException e) {
      throw new IllegalArgumentException(e);
    } finally {
      IO.close(is);
    }
  }
}

代码示例来源: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: org.apache.tomee/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: org.apache.openejb/openejb-core

public static byte[] readClassFile(final ClassLoader classLoader, final Class clazz) throws IOException {
  final String internalName = clazz.getName().replace('.', '/') + ".class";
  final URL resource = classLoader.getResource(internalName);
  final InputStream in = IO.read(resource);
  final ByteArrayOutputStream out;
  try {
    out = new ByteArrayOutputStream();
    IO.copy(in, out);
  } finally {
    IO.close(in);
  }
  return out.toByteArray();
}

代码示例来源: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 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.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-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-loader

public static void copy(final URL from, final OutputStream to) throws IOException {
  final InputStream read = read(from);
  try {
    copy(read, to);
  } finally {
    close(read);
  }
}

代码示例来源:origin: org.apache.tomee/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);
  }
}

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

public static void copy(final URL from, final OutputStream to) throws IOException {
  final InputStream read = read(from);
  try {
    copy(read, to);
  } finally {
    close(read);
  }
}

代码示例来源: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);
  }
}

代码示例来源:origin: org.apache.tomee/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.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-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);
  }
}

相关文章