Class BambooIOUtils


  • public class BambooIOUtils
    extends Object
    • Method Detail

      • contentTextEquals

        public static boolean contentTextEquals​(Reader input1,
                                                Reader input2,
                                                boolean trimLines)
                                         throws IOException
        Perform textual comparison of contents returned by two readers. Variation of IOUtils.contentEquals.
        Parameters:
        input1 - first input reader
        input2 - second input reader
        trimLines - flag enforcing trimming lines before comparison
        Returns:
        true of files are textually equal
        Throws:
        IOException - if an I/O error occurs
      • contentTextEquals

        public static boolean contentTextEquals​(InputStream input1,
                                                InputStream input2,
                                                boolean trimLines)
                                         throws IOException
        Perform textual comparison of contents returned by two input streams. Variation of IOUtils.contentEquals.
        Parameters:
        input1 - first input stream
        input2 - second input stream
        trimLines - flag enforcing trimming lines before comparison
        Returns:
        true of files are textually equal
        Throws:
        IOException - if an I/O error occurs
      • isUtf8Compliant

        public static boolean isUtf8Compliant​(@NotNull
                                              @NotNull InputStream is)
                                       throws IOException
        Checks for utf8 compliance of input stream. Does not preserve stream state and closes stream at the end.
        Parameters:
        is - the input stream to check for utf8 compliance. Does not need to (should not) be buffered.
        Returns:
        true if stream is compliant
        Throws:
        IOException - in case of IO error
      • copyWithRuntimeExceptionThrowing

        public static void copyWithRuntimeExceptionThrowing​(InputStream inputStream,
                                                            OutputStream outputStream)
        Copy input stream to output stream, closing streams when finished. Rethrowing Exception as RuntimeException. To be used in Runnable/Callable etc.