/** * Writes a byte array to an output stream from the given supplier. * * @param from the bytes to write * @param to the output supplier * @throws IOException if an I/O error occurs */ public static void write(byte[] from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSink(to).write(from); }
/** * Writes a byte array to an output stream from the given supplier. * * @param from the bytes to write * @param to the output supplier * @throws IOException if an I/O error occurs */ public static void write(byte[] from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSink(to).write(from); }
/** * Writes a byte array to an output stream from the given supplier. * * @param from the bytes to write * @param to the output supplier * @throws IOException if an I/O error occurs */ public static void write(byte[] from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSink(to).write(from); }
/** * Writes a byte array to an output stream from the given supplier. * * @param from the bytes to write * @param to the output supplier * @throws IOException if an I/O error occurs * @deprecated Use {@link ByteSink#write(byte[])} instead. This method is * scheduled for removal in Guava 18.0. */ @Deprecated public static void write(byte[] from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSink(to).write(from); }
/** * Writes a byte array to an output stream from the given supplier. * * @param from the bytes to write * @param to the output supplier * @throws IOException if an I/O error occurs */ public static void write(byte[] from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSink(to).write(from); }
/** * Writes a byte array to an output stream from the given supplier. * * @param from the bytes to write * @param to the output supplier * @throws IOException if an I/O error occurs */ public static void write(byte[] from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSink(to).write(from); }
/** * Writes a byte array to an output stream from the given supplier. * * @param from the bytes to write * @param to the output supplier * @throws IOException if an I/O error occurs * @deprecated Use {@link ByteSink#write(byte[])} instead. This method is * scheduled for removal in Guava 18.0. */ @Deprecated public static void write(byte[] from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSink(to).write(from); }
/** * Opens an output stream from the supplier, copies all bytes from the input * to the output, and closes the output stream. Does not close or flush the * input stream. * * @param from the input stream to read from * @param to the output factory * @return the number of bytes copied * @throws IOException if an I/O error occurs * @since 10.0 */ public static long copy(InputStream from, OutputSupplier<? extends OutputStream> to) throws IOException { return asByteSink(to).writeFrom(from); }
/** * Opens an output stream from the supplier, copies all bytes from the input * to the output, and closes the output stream. Does not close or flush the * input stream. * * @param from the input stream to read from * @param to the output factory * @return the number of bytes copied * @throws IOException if an I/O error occurs * @since 10.0 */ public static long copy(InputStream from, OutputSupplier<? extends OutputStream> to) throws IOException { return asByteSink(to).writeFrom(from); }
/** * Copies all bytes from a file to an {@link OutputStream} supplied by * a factory. * * @param from the source file * @param to the output factory * @throws IOException if an I/O error occurs */ public static void copy(File from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSource(from).copyTo(ByteStreams.asByteSink(to)); }
/** * Copies all bytes from a file to an {@link OutputStream} supplied by * a factory. * * @param from the source file * @param to the output factory * @throws IOException if an I/O error occurs */ public static void copy(File from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSource(from).copyTo(ByteStreams.asByteSink(to)); }
/** * Copies all bytes from a file to an {@link OutputStream} supplied by * a factory. * * @param from the source file * @param to the output factory * @throws IOException if an I/O error occurs */ public static void copy(File from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSource(from).copyTo(ByteStreams.asByteSink(to)); }
/** * Copies all bytes from a file to an {@link OutputStream} supplied by * a factory. * * @param from the source file * @param to the output factory * @throws IOException if an I/O error occurs */ public static void copy(File from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSource(from).copyTo(ByteStreams.asByteSink(to)); }
/** * Opens input and output streams from the given suppliers, copies all * bytes from the input to the output, and closes the streams. * * @param from the input factory * @param to the output factory * @return the number of bytes copied * @throws IOException if an I/O error occurs */ public static long copy(InputSupplier<? extends InputStream> from, OutputSupplier<? extends OutputStream> to) throws IOException { return asByteSource(from).copyTo(asByteSink(to)); }
/** * Opens input and output streams from the given suppliers, copies all * bytes from the input to the output, and closes the streams. * * @param from the input factory * @param to the output factory * @return the number of bytes copied * @throws IOException if an I/O error occurs */ public static long copy(InputSupplier<? extends InputStream> from, OutputSupplier<? extends OutputStream> to) throws IOException { return asByteSource(from).copyTo(asByteSink(to)); }
/** * Copies all bytes from a file to an {@link OutputStream} supplied by * a factory. * * @param from the source file * @param to the output factory * @throws IOException if an I/O error occurs */ public static void copy(File from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSource(from).copyTo(ByteStreams.asByteSink(to)); }
/** * Returns a factory that will supply instances of {@link OutputStreamWriter}, * using the given {@link OutputStream} factory and character set. * * @param out the factory that will be used to open output streams * @param charset the charset used to encode the output stream; see {@link * Charsets} for helpful predefined constants * @return the factory */ public static OutputSupplier<OutputStreamWriter> newWriterSupplier( final OutputSupplier<? extends OutputStream> out, final Charset charset) { return asOutputSupplier( ByteStreams.asByteSink(out).asCharSink(charset)); }
/** * Returns a factory that will supply instances of {@link OutputStreamWriter}, * using the given {@link OutputStream} factory and character set. * * @param out the factory that will be used to open output streams * @param charset the charset used to encode the output stream; see {@link * Charsets} for helpful predefined constants * @return the factory */ public static OutputSupplier<OutputStreamWriter> newWriterSupplier( final OutputSupplier<? extends OutputStream> out, final Charset charset) { return asOutputSupplier( ByteStreams.asByteSink(out).asCharSink(charset)); }
/** * Opens input and output streams from the given suppliers, copies all * bytes from the input to the output, and closes the streams. * * @param from the input factory * @param to the output factory * @return the number of bytes copied * @throws IOException if an I/O error occurs */ public static long copy(InputSupplier<? extends InputStream> from, OutputSupplier<? extends OutputStream> to) throws IOException { return asByteSource(from).copyTo(asByteSink(to)); }
/** * Opens input and output streams from the given suppliers, copies all * bytes from the input to the output, and closes the streams. * * @param from the input factory * @param to the output factory * @return the number of bytes copied * @throws IOException if an I/O error occurs */ public static long copy(InputSupplier<? extends InputStream> from, OutputSupplier<? extends OutputStream> to) throws IOException { return asByteSource(from).copyTo(asByteSink(to)); }