dap4/d4lib/src/main/java/dap4/dap4lib/ChunkInputStream.java
boolean
    readHeader(InputStream input)
            throws IOException
    {
        byte[] bytehdr = new byte[4];
        int red = input.read(bytehdr);
        if(red == -1) return false;
        if(red < 4)
            throw new IOException("Short binary chunk count");
        this.flags = ((int) bytehdr[0]) & 0xFF; // Keep unsigned
        bytehdr[0] = 0;
        ByteBuffer buf = ByteBuffer.wrap(bytehdr).order(ByteOrder.BIG_ENDIAN);
        this.chunksize = buf.getInt();
        this.avail = this.chunksize;
        return true;
    }
boolean
    readHeader(InputStream input)
            throws IOException
    {
        byte[] bytehdr = new byte[4];
        int red = input.read(bytehdr);
        if(red == -1) return false;
        if(red < 4)
            throw new IOException("Short binary chunk count");
        this.flags = ((int) bytehdr[0]) & 0xFF; // Keep unsigned
        bytehdr[0] = 0;
        ByteBuffer buf = ByteBuffer.wrap(bytehdr).order(ByteOrder.BIG_ENDIAN);
        this.chunksize = buf.getInt();
        this.avail = this.chunksize;
        return true;
    }
boolean readHeader ( InputStream input ) throws IOException { byte [ ] bytehdr = new byte [ 4 ] ; int red = input . read ( bytehdr ) ; if ( red == - 1 ) return false ; if ( red < 4 ) throw new IOException ( "Short binary chunk count" ) ; this . flags = ( ( int ) bytehdr [ 0 ] ) & 0xFF ; // Keep unsigned bytehdr [ 0 ] = 0 ; ByteBuffer buf = ByteBuffer . wrap ( bytehdr ) . order ( ByteOrder . BIG_ENDIAN ) ; this . chunksize = buf . getInt ( ) ; this . avail = this . chunksize ; return true ; }
Read the size+flags header from the input stream and use it to
initialize the chunk state

@param input The input streamfrom which to read
@return true if header read false if immediate eof encountered
Read the size + flags header from the input stream and use it to initialize the chunk state