Package nbbrd.io

Class BlockSizer


  • public class BlockSizer
    extends Object
    System-wide utility that gets the number of bytes per block from several byte sources. May be overridden to deal with new JDK APIs.
    • Constructor Detail

      • BlockSizer

        public BlockSizer()
    • Method Detail

      • getBlockSize

        public long getBlockSize​(InputStream stream)
                          throws IOException
        Returns the number of bytes per block in the input stream implementation.
        Parameters:
        stream - a non-null input stream as byte source
        Returns:
        a positive value representing the block size in bytes if available, -1 otherwise
        Throws:
        IOException - if an I/O error occurs
      • getBlockSize

        public long getBlockSize​(OutputStream stream)
                          throws IOException
        Returns the number of bytes per block in the output stream implementation.
        Parameters:
        stream - a non-null output stream as byte source
        Returns:
        a positive value representing the block size in bytes if available, -1 otherwise
        Throws:
        IOException - if an I/O error occurs