@Test(expected = IllegalArgumentException.class) public void testWriteToWithNullOutput() throws Exception { ParseCountingFileHttpBody body = new ParseCountingFileHttpBody( makeTestFile(temporaryFolder.getRoot()), null); body.writeTo(null); }
@Override public void writeTo(OutputStream output) throws IOException { if (output == null) { throw new IllegalArgumentException("Output stream may not be null"); } final FileInputStream fileInput = new FileInputStream(file); try { byte[] buffer = new byte[DEFAULT_CHUNK_SIZE]; int n; long totalLength = file.length(); long position = 0; while (EOF != (n = fileInput.read(buffer))) { output.write(buffer, 0, n); position += n; if (progressCallback != null) { int progress = (int) (100 * position / totalLength); progressCallback.done(progress); } } } finally { ParseIOUtils.closeQuietly(fileInput); } }
ParseCountingFileHttpBody extends ParseFileHttpBody { @Override public void writeTo(OutputStream output) throws IOException { if (output == null) { throw new IllegalArgumentException("Output stream may not be null"); } final FileInputStream fileInput = new FileInputStream(file); try { byte[] buffer = new byte[DEFAULT_CHUNK_SIZE]; int n; long totalLength = file.length(); long position = 0; while (EOF != (n = fileInput.read(buffer))) { output.write(buffer, 0, n); position += n; if (progressCallback != null) { int progress = (int) (100 * position / totalLength); progressCallback.done(progress); } } } finally { ParseIOUtils.closeQuietly(fileInput); } } }
ParseCountingFileHttpBody extends ParseFileHttpBody { @Override public void writeTo(OutputStream output) throws IOException { if (output == null) { throw new IllegalArgumentException("Output stream may not be null"); } final FileInputStream fileInput = new FileInputStream(file); try { byte[] buffer = new byte[DEFAULT_CHUNK_SIZE]; int n; long totalLength = file.length(); long position = 0; while (EOF != (n = fileInput.read(buffer))) { output.write(buffer, 0, n); position += n; if (progressCallback != null) { int progress = (int) (100 * position / totalLength); progressCallback.done(progress); } } } finally { ParseIOUtils.closeQuietly(fileInput); } } ParseCountingFileHttpBody(File file, ProgressCallback progressCallback);  ParseCountingFileHttpBody(
            File file, String contentType, ProgressCallback progressCallback); }
ParseCountingFileHttpBody extends ParseFileHttpBody { @Override public void writeTo(OutputStream output) throws IOException { if (output == null) { throw new IllegalArgumentException("Output stream may not be null"); } final FileInputStream fileInput = new FileInputStream(file); try { byte[] buffer = new byte[DEFAULT_CHUNK_SIZE]; int n; long totalLength = file.length(); long position = 0; while (EOF != (n = fileInput.read(buffer))) { output.write(buffer, 0, n); position += n; if (progressCallback != null) { int progress = (int) (100 * position / totalLength); progressCallback.done(progress); } } } finally { ParseIOUtils.closeQuietly(fileInput); } } ParseCountingFileHttpBody(File file, ProgressCallback progressCallback);  ParseCountingFileHttpBody(
            File file, String contentType, ProgressCallback progressCallback); @Override void writeTo(OutputStream output); }
ParseCountingFileHttpBody extends ParseFileHttpBody { @Override public void writeTo(OutputStream output) throws IOException { if (output == null) { throw new IllegalArgumentException("Output stream may not be null"); } final FileInputStream fileInput = new FileInputStream(file); try { byte[] buffer = new byte[DEFAULT_CHUNK_SIZE]; int n; long totalLength = file.length(); long position = 0; while (EOF != (n = fileInput.read(buffer))) { output.write(buffer, 0, n); position += n; if (progressCallback != null) { int progress = (int) (100 * position / totalLength); progressCallback.done(progress); } } } finally { ParseIOUtils.closeQuietly(fileInput); } } ParseCountingFileHttpBody(File file, ProgressCallback progressCallback);  ParseCountingFileHttpBody(
            File file, String contentType, ProgressCallback progressCallback); @Override void writeTo(OutputStream output);  }