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

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

本文整理了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

  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.tomee/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.tomee/openejb-loader

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

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

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

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

  1. public static void jarDir(final File dir, final File zipName) throws IOException, IllegalArgumentException {
  2. final String[] entries = dir.list();
  3. final JarOutputStream out = new JarOutputStream(new FileOutputStream(zipName));
  4. String prefix = dir.getAbsolutePath();
  5. if (!prefix.endsWith(File.separator)) {
  6. prefix += File.separator;
  7. }
  8. for (final String entry : entries) {
  9. final File f = new File(dir, entry);
  10. jarFile(out, f, prefix);
  11. }
  12. IO.close(out);
  13. }

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

  1. private void internalProcessAnnotationsStream(final Collection<String> urls, final WebXml fragment,
  2. final boolean handlesTypeOnly) {
  3. for (final String url : urls) {
  4. InputStream is = null;
  5. try {
  6. is = new URL(url).openStream();
  7. super.processAnnotationsStream(is, fragment, handlesTypeOnly, EMPTY_MAP);
  8. } catch (final IOException e) {
  9. throw new IllegalArgumentException(e);
  10. } finally {
  11. IO.close(is);
  12. }
  13. }
  14. }

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

  1. public static byte[] readClassFile(final ClassLoader classLoader, final Class clazz) throws IOException {
  2. final String internalName = clazz.getName().replace('.', '/') + ".class";
  3. final URL resource = classLoader.getResource(internalName);
  4. final InputStream in = IO.read(resource);
  5. final ByteArrayOutputStream out;
  6. try {
  7. out = new ByteArrayOutputStream();
  8. IO.copy(in, out);
  9. } finally {
  10. IO.close(in);
  11. }
  12. return out.toByteArray();
  13. }

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

  1. public static void copy(final URL 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-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. }

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

  1. public static void copy(final URL 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.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. }

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

相关文章