@Test public void basicCopyingWorks() throws IOException { String dir = CoreTestConstants.OUTPUT_DIR_PREFIX+"/fu"+diff; File dirFile = new File(dir); dirFile.mkdir(); String src = CoreTestConstants.TEST_INPUT_PREFIX + "compress1.copy"; String target = CoreTestConstants.OUTPUT_DIR_PREFIX+"/fu"+diff+"/copyingWorks.txt"; fileUtil.copy(src, target); Compare.compare(src, target); }
public void copy(String src, String destination) throws RolloverFailure { BufferedInputStream bis = null; BufferedOutputStream bos = null; try { bis = new BufferedInputStream(new FileInputStream(src)); bos = new BufferedOutputStream(new FileOutputStream(destination)); byte[] inbuf = new byte[BUF_SIZE]; int n; while ((n = bis.read(inbuf)) != -1) { bos.write(inbuf, 0, n); } bis.close(); bis = null; bos.close(); bos = null; } catch (IOException ioe) { String msg = "Failed to copy [" + src + "] to [" + destination + "]"; addError(msg, ioe); throw new RolloverFailure(msg); } finally { if (bis != null) { try { bis.close(); } catch (IOException e) { } } if (bos != null) { try { bos.close(); } catch (IOException e) { } } } }
FileUtil extends ContextAwareBase { public void copy(String src, String destination) throws RolloverFailure { BufferedInputStream bis = null; BufferedOutputStream bos = null; try { bis = new BufferedInputStream(new FileInputStream(src)); bos = new BufferedOutputStream(new FileOutputStream(destination)); byte[] inbuf = new byte[BUF_SIZE]; int n; while ((n = bis.read(inbuf)) != -1) { bos.write(inbuf, 0, n); } bis.close(); bis = null; bos.close(); bos = null; } catch (IOException ioe) { String msg = "Failed to copy [" + src + "] to [" + destination + "]"; addError(msg, ioe); throw new RolloverFailure(msg); } finally { if (bis != null) { try { bis.close(); } catch (IOException e) { } } if (bos != null) { try { bos.close(); } catch (IOException e) { } } } } }
FileUtil extends ContextAwareBase { public void copy(String src, String destination) throws RolloverFailure { BufferedInputStream bis = null; BufferedOutputStream bos = null; try { bis = new BufferedInputStream(new FileInputStream(src)); bos = new BufferedOutputStream(new FileOutputStream(destination)); byte[] inbuf = new byte[BUF_SIZE]; int n; while ((n = bis.read(inbuf)) != -1) { bos.write(inbuf, 0, n); } bis.close(); bis = null; bos.close(); bos = null; } catch (IOException ioe) { String msg = "Failed to copy [" + src + "] to [" + destination + "]"; addError(msg, ioe); throw new RolloverFailure(msg); } finally { if (bis != null) { try { bis.close(); } catch (IOException e) { } } if (bos != null) { try { bos.close(); } catch (IOException e) { } } } } FileUtil(Context context); }
FileUtil extends ContextAwareBase { public void copy(String src, String destination) throws RolloverFailure { BufferedInputStream bis = null; BufferedOutputStream bos = null; try { bis = new BufferedInputStream(new FileInputStream(src)); bos = new BufferedOutputStream(new FileOutputStream(destination)); byte[] inbuf = new byte[BUF_SIZE]; int n; while ((n = bis.read(inbuf)) != -1) { bos.write(inbuf, 0, n); } bis.close(); bis = null; bos.close(); bos = null; } catch (IOException ioe) { String msg = "Failed to copy [" + src + "] to [" + destination + "]"; addError(msg, ioe); throw new RolloverFailure(msg); } finally { if (bis != null) { try { bis.close(); } catch (IOException e) { } } if (bos != null) { try { bos.close(); } catch (IOException e) { } } } } FileUtil(Context context); static URL fileToURL(File file); static boolean createMissingParentDirectories(File file); static String prefixRelativePath(String prefix, String path); void copy(String src, String destination); }
FileUtil extends ContextAwareBase { public void copy(String src, String destination) throws RolloverFailure { BufferedInputStream bis = null; BufferedOutputStream bos = null; try { bis = new BufferedInputStream(new FileInputStream(src)); bos = new BufferedOutputStream(new FileOutputStream(destination)); byte[] inbuf = new byte[BUF_SIZE]; int n; while ((n = bis.read(inbuf)) != -1) { bos.write(inbuf, 0, n); } bis.close(); bis = null; bos.close(); bos = null; } catch (IOException ioe) { String msg = "Failed to copy [" + src + "] to [" + destination + "]"; addError(msg, ioe); throw new RolloverFailure(msg); } finally { if (bis != null) { try { bis.close(); } catch (IOException e) { } } if (bos != null) { try { bos.close(); } catch (IOException e) { } } } } FileUtil(Context context); static URL fileToURL(File file); static boolean createMissingParentDirectories(File file); static String prefixRelativePath(String prefix, String path); void copy(String src, String destination);  }