@Test public void testWrite() throws IOException { InputStream is = Mockito.mock(InputStream.class); OutputStream out = Mockito.mock(OutputStream.class); when(is.read(any())).thenReturn(-1); InputStreamStreamingOutput streamingOutput = new InputStreamStreamingOutput(is); streamingOutput.write(out); verifyNoMoreInteractions(out); }
@Override public void write(OutputStream output) throws IOException, WebApplicationException { byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = input.read(buffer)) != -1) { output.write(buffer, 0, bytesRead); } }
InputStreamStreamingOutput implements StreamingOutput { @Override public void write(OutputStream output) throws IOException, WebApplicationException { byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = input.read(buffer)) != -1) { output.write(buffer, 0, bytesRead); } } }
InputStreamStreamingOutput implements StreamingOutput { @Override public void write(OutputStream output) throws IOException, WebApplicationException { byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = input.read(buffer)) != -1) { output.write(buffer, 0, bytesRead); } } InputStreamStreamingOutput(@NotNull InputStream input); }
InputStreamStreamingOutput implements StreamingOutput { @Override public void write(OutputStream output) throws IOException, WebApplicationException { byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = input.read(buffer)) != -1) { output.write(buffer, 0, bytesRead); } } InputStreamStreamingOutput(@NotNull InputStream input); @Override void write(OutputStream output); }
InputStreamStreamingOutput implements StreamingOutput { @Override public void write(OutputStream output) throws IOException, WebApplicationException { byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = input.read(buffer)) != -1) { output.write(buffer, 0, bytesRead); } } InputStreamStreamingOutput(@NotNull InputStream input); @Override void write(OutputStream output);  }