protected ByteArrayOutputStream copyStream(final InputStream is) throws IOException { final ByteArrayOutputStream bout = new ByteArrayOutputStream(); if(is != null) { StreamUtils.copyStream(is, bout); } return bout; }
protected ByteArrayOutputStream copyStream(final InputStream is) throws IOException { final ByteArrayOutputStream bout = new ByteArrayOutputStream(); if(is != null) { StreamUtils.copyStream(is, bout); } return bout; }
@Override public void copyStream(final DataOutput output) throws IOException { try (InputStream in = new BufferedInputStream(Files.newInputStream(file))) { StreamUtils.copyStream(in, output); } }
@Override public void copyStream(final DataOutput output) throws IOException { try (InputStream in = new BufferedInputStream(Files.newInputStream(file))) { StreamUtils.copyStream(in, output); } }
@Override public synchronized void copyStream(final DataOutput output) throws IOException { final FileInputStream is = new FileInputStream(temp); try { StreamUtils.copyStream(is, output); } finally { StreamUtils.safeClose(is); } }
@Override public synchronized void copyStream(final DataOutput output) throws IOException { final FileInputStream is = new FileInputStream(temp); try { StreamUtils.copyStream(is, output); } finally { StreamUtils.safeClose(is); } }
@Override public void copyStream(final DataOutput output) throws IOException { final FileInputStream is = new FileInputStream(file); try { StreamUtils.copyStream(is, output); is.close(); } finally { StreamUtils.safeClose(is); } }
@Override public void copyStream(final DataOutput output) throws IOException { final FileInputStream is = new FileInputStream(file); try { StreamUtils.copyStream(is, output); is.close(); } finally { StreamUtils.safeClose(is); } }
@Override public void copyStream(final DataOutput output) throws IOException { final FileInputStream is = new FileInputStream(file); try { StreamUtils.copyStream(is, output); is.close(); } finally { StreamUtils.safeClose(is); } }
@Override public synchronized int initialize() throws IOException { final ByteArrayOutputStream os = new ByteArrayOutputStream(); try { StreamUtils.copyStream(original, os); } finally { if(autoClose) { StreamUtils.safeClose(original); } } data = os.toByteArray(); return data.length; }
protected File copyStream(final InputStream is, final File tempDir) throws IOException { final File temp = File.createTempFile("upload", "temp", tempDir); if (is != null) { final FileOutputStream os = new FileOutputStream(temp); try { StreamUtils.copyStream(is, os); os.close(); } finally { StreamUtils.safeClose(os); } } return temp; } }
@Override public synchronized int initialize() throws IOException { final ByteArrayOutputStream os = new ByteArrayOutputStream(); try { StreamUtils.copyStream(original, os); } finally { if(autoClose) { StreamUtils.safeClose(original); } } data = os.toByteArray(); return data.length; }
protected File copyStream(final InputStream is, final File tempDir) throws IOException { final File temp = File.createTempFile("upload", "temp", tempDir); if (is != null) { final FileOutputStream os = new FileOutputStream(temp); try { StreamUtils.copyStream(is, os); os.close(); } finally { StreamUtils.safeClose(os); } } return temp; } }
private byte[] getContent(File file) throws IOException { InputStream in = null; ByteArrayOutputStream out = new ByteArrayOutputStream(); try { in = new FileInputStream(file); StreamUtils.copyStream(in, out); return out.toByteArray(); } finally { StreamUtils.safeClose(in); StreamUtils.safeClose(out); } }
private byte[] getContent(File file) throws IOException { InputStream in = null; ByteArrayOutputStream out = new ByteArrayOutputStream(); try { in = new FileInputStream(file); StreamUtils.copyStream(in, out); return out.toByteArray(); } finally { StreamUtils.safeClose(in); StreamUtils.safeClose(out); } }
static void copyFile(final File file, final File backup) throws IOException { final FileInputStream fis = new FileInputStream(file); try { final FileOutputStream fos = new FileOutputStream(backup); try { StreamUtils.copyStream(fis, fos); fos.flush(); fos.getFD().sync(); fos.close(); } finally { StreamUtils.safeClose(fos); } } finally { StreamUtils.safeClose(fis); } }
static void copyFile(final File file, final File backup) throws IOException { final InputStream in = new BufferedInputStream(new FileInputStream(file)); try { final FileOutputStream fos = new FileOutputStream(backup); final BufferedOutputStream output = new BufferedOutputStream(fos); try { StreamUtils.copyStream(in, output); output.flush(); fos.getFD().sync(); fos.close(); } finally { StreamUtils.safeClose(output); } } finally { StreamUtils.safeClose(in); } }
private void copyFile(final File file, final File backup) throws IOException { final InputStream in = new BufferedInputStream(new FileInputStream(file)); try { final FileOutputStream fos = new FileOutputStream(backup); final BufferedOutputStream output = new BufferedOutputStream(fos); try { StreamUtils.copyStream(in, output); //Flush and force the file to sync output.flush(); fos.getFD().sync(); fos.close(); } finally { StreamUtils.safeClose(output); } } finally { StreamUtils.safeClose(in); } }
protected void copyFile(final File file, final File backup) throws IOException { final InputStream in = new BufferedInputStream(new FileInputStream(file)); try { final FileOutputStream fos = new FileOutputStream(backup); final BufferedOutputStream output = new BufferedOutputStream(fos); try { StreamUtils.copyStream(in, output); //Flush and force the file to sync output.flush(); fos.getFD().sync(); fos.close(); } finally { StreamUtils.safeClose(output); } } finally { StreamUtils.safeClose(in); } }
public synchronized int initialize() throws IOException { if(temp == null) { temp = File.createTempFile("client", "stream"); final FileOutputStream os = new FileOutputStream(temp); try { StreamUtils.copyStream(original, os); os.flush(); os.close(); } finally { StreamUtils.safeClose(os); if(autoClose) { StreamUtils.safeClose(original); } } } return (int) temp.length(); }