Class TCStreamUtil


  • public class TCStreamUtil
    extends Object
    • Constructor Detail

      • TCStreamUtil

        public TCStreamUtil()
    • Method Detail

      • writeBinary

        public static void writeBinary​(@NotNull
                                       InputStream input,
                                       @NotNull
                                       OutputStream output,
                                       @Nullable
                                       TCStreamUtil.WriteProgressListener listener,
                                       long minProgressIntervalMillis)
                                throws 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:
        IOException - if IOException occurs
      • setFileMode

        public static boolean setFileMode​(@Nullable
                                          File file,
                                          @NotNull
                                          String mode)
                                   throws 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:
        IOException - if process run crashed unexpectedly
      • haveEqualContent

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

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