Module de.carne
Package de.carne.io

Class ChecksumOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class ChecksumOutputStream
    extends java.io.FilterOutputStream
    FilterOutputStream that calculates a checksum of the written data.
    • Field Summary

      • Fields inherited from class java.io.FilterOutputStream

        out
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getChecksumValue()
      Gets the checksum value corresponding to the written data and resets the checksum processor.
      void write​(byte @Nullable [] b)  
      void write​(byte @Nullable [] b, int off, int len)  
      void write​(int b)  
      • Methods inherited from class java.io.FilterOutputStream

        close, flush
      • Methods inherited from class java.io.OutputStream

        nullOutputStream
      • Methods inherited from class java.lang.Object

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

      • ChecksumOutputStream

        public ChecksumOutputStream​(java.io.OutputStream out,
                                    Checksum checksum)
        Constructs a new ChecksumOutputStream instance.
        Parameters:
        out - the underlying OutputStream.
        checksum - the Checksum instance to use for checksum calculation.
    • Method Detail

      • getChecksumValue

        public byte[] getChecksumValue()
        Gets the checksum value corresponding to the written data and resets the checksum processor.
        Returns:
        the checksum value corresponding to the written data.
        See Also:
        Checksum.getValue()
      • write

        public void write​(int b)
                   throws java.io.IOException
        Overrides:
        write in class java.io.FilterOutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte @Nullable [] b)
                   throws java.io.IOException
        Overrides:
        write in class java.io.FilterOutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte @Nullable [] b,
                          int off,
                          int len)
                   throws java.io.IOException
        Overrides:
        write in class java.io.FilterOutputStream
        Throws:
        java.io.IOException