Class StreamUtils


  • public final class StreamUtils
    extends java.lang.Object
    Stream utility class
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void copy​(java.io.InputStream is, java.io.OutputStream os)
      Copy stream
      static StreamUtils getInstance()
      Get the instance
      boolean hasHeader​(java.lang.String name, java.io.InputStream stream, byte[] header)
      Check content header
      java.io.File save​(java.io.InputStream is, java.io.File file)
      Store a stream into a file
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInstance

        public static StreamUtils getInstance()
        Get the instance
        Returns:
        the instance
      • hasHeader

        public boolean hasHeader​(java.lang.String name,
                                 java.io.InputStream stream,
                                 byte[] header)
        Check content header
        Parameters:
        name - the name
        stream - the stream
        header - the header to check
        Returns:
        true if it has the header
      • copy

        public void copy​(java.io.InputStream is,
                         java.io.OutputStream os)
                  throws java.io.IOException
        Copy stream
        Parameters:
        is - the input stream
        os - the output stream
        Throws:
        java.io.IOException - In case of an I/O error
      • save

        public java.io.File save​(java.io.InputStream is,
                                 java.io.File file)
                          throws java.io.IOException
        Store a stream into a file
        Parameters:
        is - the input stream
        file - the file
        Returns:
        the file
        Throws:
        java.io.IOException - In case of an I/O error