Class StreamUtils


  • public abstract class StreamUtils
    extends Object

    StreamUtils class.

    • Constructor Detail

      • StreamUtils

        public StreamUtils()
    • Method Detail

      • streamToStream

        public static void streamToStream​(Reader in,
                                          Writer out)
                                   throws IOException
        Convenience method for reading data from a Reader and then immediately writing that data to a Writer with a default buffer size of one kilobyte (1,024 chars).
        Parameters:
        in - a data source
        out - a data sink
        Throws:
        IOException - if any.
      • streamToStream

        public static void streamToStream​(Reader in,
                                          Writer out,
                                          int bufferSize)
                                   throws IOException
        Convenience method for reading data from a Reader and then immediately writing that data to a Writer.
        Parameters:
        in - a data source
        out - a data sink
        bufferSize - the size of the char buffer to use for each read/write
        Throws:
        IOException - if any.
      • streamToStream

        public static void streamToStream​(InputStream in,
                                          OutputStream out)
                                   throws IOException
        Convenience method for reading data from an InputStream and then immediately writing that data to an OutputStream with a default buffer size of one kilobyte (1,024 bytes).
        Parameters:
        in - a data source
        out - a data sink
        Throws:
        IOException - if any.
      • streamToStream

        public static void streamToStream​(InputStream in,
                                          OutputStream out,
                                          int bufferSize)
                                   throws IOException
        Convenience method for reading data from an InputStream and then immediately writing that data to an OutputStream.
        Parameters:
        in - a data source
        out - a data sink
        bufferSize - the size of the byte buffer to use for each read/write
        Throws:
        IOException - if any.