Code example for DataInput

Methods: readFully

0
        { 
            byte newbuf[] = new byte[Math.max(buf.length << 1, newcount)];
            System.arraycopy(buf, 0, newbuf, 0, count);
            buf = newbuf;
        } 
        in.readFully(buf, count, len);
        count = newcount;
    } 
     
    /** 
     * @return The valid contents of the buffer, possibly by copying: only safe for one-time-use buffers. 
     */ 
    public byte[] asByteArray() 
    { 
        if (count == buf.length)
            // no-copy 
            return buf;
        // copy 
        return this.toByteArray();
    } 
}