@Test public void testCopy() throws Exception { String testString = "Testing©ÿ»"; byte[] stringBytes = testString.getBytes(); InputStream inputStream = new ByteArrayInputStream(Arrays.copyOf(stringBytes, stringBytes.length)); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Streams.copy(inputStream, outputStream); assertTrue( "Byte arrays should be equal", Arrays.equals(stringBytes, outputStream.toByteArray())); }
public static void copy(final InputStream inputStream, final OutputStream outputStream) throws IOException { new ByteSource() { @Override public InputStream openStream() { return inputStream; } }.copyTo(new ByteSink() { @Override public OutputStream openStream() { return outputStream; } }); }
Streams { public static void copy(final InputStream inputStream, final OutputStream outputStream) throws IOException { new ByteSource() { @Override public InputStream openStream() { return inputStream; } }.copyTo(new ByteSink() { @Override public OutputStream openStream() { return outputStream; } }); } }
Streams { public static void copy(final InputStream inputStream, final OutputStream outputStream) throws IOException { new ByteSource() { @Override public InputStream openStream() { return inputStream; } }.copyTo(new ByteSink() { @Override public OutputStream openStream() { return outputStream; } }); } private  Streams(); }
Streams { public static void copy(final InputStream inputStream, final OutputStream outputStream) throws IOException { new ByteSource() { @Override public InputStream openStream() { return inputStream; } }.copyTo(new ByteSink() { @Override public OutputStream openStream() { return outputStream; } }); } private  Streams(); @Deprecated static InputStream wrapString(String str); static InputStream wrapString(String str, Charset charset); @Deprecated static String readAll(final InputStream inputStream); static String readAll(final InputStream inputStream, Charset charset); @Deprecated static void write(String str, final OutputStream outputStream); static void write(String str, final OutputStream outputStream, Charset charset); static void copy(final InputStream inputStream, final OutputStream outputStream); }
Streams { public static void copy(final InputStream inputStream, final OutputStream outputStream) throws IOException { new ByteSource() { @Override public InputStream openStream() { return inputStream; } }.copyTo(new ByteSink() { @Override public OutputStream openStream() { return outputStream; } }); } private  Streams(); @Deprecated static InputStream wrapString(String str); static InputStream wrapString(String str, Charset charset); @Deprecated static String readAll(final InputStream inputStream); static String readAll(final InputStream inputStream, Charset charset); @Deprecated static void write(String str, final OutputStream outputStream); static void write(String str, final OutputStream outputStream, Charset charset); static void copy(final InputStream inputStream, final OutputStream outputStream);  }