Class TCStreamUtil


  • public class TCStreamUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      TCStreamUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean haveEqualContent​(java.io.InputStream stream1, java.io.InputStream stream2)  
      static boolean haveEqualContentIgnoringLineEndings​(java.io.Reader reader1, java.io.Reader reader2)  
      static java.lang.String readString​(java.io.DataInputStream input)  
      static boolean setFileMode​(java.io.File file, java.lang.String mode)  
      static void skip​(java.io.InputStream input, long size)  
      static void writeBinary​(java.io.InputStream input, long length, java.io.OutputStream output)  
      static void writeBinary​(java.io.InputStream input, java.io.OutputStream output)
      Copies input stream into output stream using internal buffer
      static void writeBinary​(java.io.InputStream input, java.io.OutputStream output, TCStreamUtil.WriteProgressListener listener, long minProgressIntervalMillis)
      Copies input stream into output stream using internal buffer
      static void writeString​(java.io.DataOutputStream outputStream, java.lang.String string)  
      • Methods inherited from class java.lang.Object

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

      • TCStreamUtil

        public TCStreamUtil()
    • Method Detail

      • skip

        public static void skip​(@NotNull
                                java.io.InputStream input,
                                long size)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • writeBinary

        public static void writeBinary​(@NotNull
                                       java.io.InputStream input,
                                       long length,
                                       @NotNull
                                       java.io.OutputStream output)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • writeBinary

        public static void writeBinary​(java.io.InputStream input,
                                       java.io.OutputStream output)
                                throws java.io.IOException
        Copies input stream into output stream using internal buffer
        Throws:
        java.io.IOException
      • writeBinary

        public static void writeBinary​(@NotNull
                                       java.io.InputStream input,
                                       @NotNull
                                       java.io.OutputStream output,
                                       @Nullable
                                       TCStreamUtil.WriteProgressListener listener,
                                       long minProgressIntervalMillis)
                                throws java.io.IOException
        Copies input stream into output stream using internal buffer
        Parameters:
        input - input stream to be processed
        output - stream where input stream will be copied
        listener - progress listener which can also cancel the process
        minProgressIntervalMillis - number of milliseconds between calls to the listener
        Throws:
        java.io.IOException - if IOException occurs
      • setFileMode

        public static boolean setFileMode​(@Nullable
                                          java.io.File file,
                                          @NotNull
                                          java.lang.String mode)
                                   throws java.io.IOException
        Parameters:
        file - file
        mode - mode to be sent to 'chmod' command
        Returns:
        true if windows os is used or if operation has succeeded, false is returned otherwise
        Throws:
        java.io.IOException - if process run crashed unexpectedly
      • readString

        @Nullable
        public static java.lang.String readString​(@NotNull
                                                  java.io.DataInputStream input)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • writeString

        public static void writeString​(@NotNull
                                       java.io.DataOutputStream outputStream,
                                       @NotNull
                                       java.lang.String string)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • haveEqualContent

        public static boolean haveEqualContent​(@NotNull
                                               java.io.InputStream stream1,
                                               @NotNull
                                               java.io.InputStream stream2)
      • haveEqualContentIgnoringLineEndings

        public static boolean haveEqualContentIgnoringLineEndings​(java.io.Reader reader1,
                                                                  java.io.Reader reader2)
                                                           throws java.io.IOException
        Throws:
        java.io.IOException