B2B Data Exchange
- B2B Data Exchange 10.2
- All Products
private long copy() throws IOException { InputStream in = null; OutputStream out = null; try { final int bufferSize = 4096; in = new BufferedInputStream(new FileInputStream(sourceFile), bufferSize); out = new BufferedOutputStream(new FileOutputStream(new File( destinationDirectory, sourceFile.getName())), bufferSize); byte[] buffer = new byte[bufferSize]; int bytesRead = 0; long bytesCopied = 0L; while ((bytesRead = in.read(buffer)) != -1) { checkForHoldAndCancel(); out.write(buffer, 0, bytesRead); bytesCopied += bytesRead; } return bytesCopied; } finally { if (in != null) { try { in.close(); } catch (IOException exp) { exp.printStackTrace(); } } if (out != null) { try { out.close(); } catch (IOException exp) { exp.printStackTrace(); } } } }