public static CheckSum compute(final InputStream stream, boolean standardizeLineEndings) {
        InputStream newStream = stream;
        if (standardizeLineEndings) {
            newStream = new InputStream() {
                private boolean isPrevR = false;

                @Override
                public int read() throws IOException {
                    int read = stream.read();

                    if (read == '\r') {
                        isPrevR = true;
                        return '\n';
                    } else if (read == '\n' && isPrevR) {
                        isPrevR = false;
                        return read();
                    } else {
                        isPrevR = false;
                        return read;
                    }
                }
            };
        }

        return new CheckSum(MD5Util.computeMD5(newStream), getCurrentVersion());
    }
public static CheckSum compute(final InputStream stream, boolean standardizeLineEndings) {
        InputStream newStream = stream;
        if (standardizeLineEndings) {
            newStream = new InputStream() {
                private boolean isPrevR = false;

                @Override
                public int read() throws IOException {
                    int read = stream.read();

                    if (read == '\r') {
                        isPrevR = true;
                        return '\n';
                    } else if (read == '\n' && isPrevR) {
                        isPrevR = false;
                        return read();
                    } else {
                        isPrevR = false;
                        return read;
                    }
                }
            };
        }

        return new CheckSum(MD5Util.computeMD5(newStream), getCurrentVersion());
    }
public static CheckSum compute ( final InputStream stream , boolean standardizeLineEndings ) { InputStream newStream = stream ; if ( standardizeLineEndings ) { newStream = new InputStream ( ) { private boolean isPrevR = false ; @ Override public int read ( ) throws IOException { int read = stream . read ( ) ; if ( read == ' ' ) { isPrevR = true ; return ' ' ; } else if ( read == ' ' && isPrevR ) { isPrevR = false ; return read ( ) ; } else { isPrevR = false ; return read ; } } } ; } return new CheckSum ( MD5Util . computeMD5 ( newStream ) , getCurrentVersion ( ) ) ; }
Compute a CheckSum of the given data stream (no normalization of line endings!)
Compute a CheckSum of the given data stream ( no normalization of line endings! )