@Override
    public void write(byte[] b, int off, int len) throws IOException
    {
        int wbytes = len;
        int offset = off;
        
        while( wbytes > 0 )
        {
            if ( buf.position() >= buf.capacity() )
            {
                flush();
            }
            
            int length = Math.min( wbytes, buf.limit() - buf.position() );
            
            buf.put(b, offset, length);
            
            offset += length;
            wbytes -= length;
        }
    }
@ Override public void write ( byte [ ] b , int off , int len ) throws IOException { int wbytes = len ; int offset = off ; while ( wbytes > 0 ) { if ( buf . position ( ) >= buf . capacity ( ) ) { flush ( ) ; } int length = Math . min ( wbytes , buf . limit ( ) - buf . position ( ) ) ; buf . put ( b , offset , length ) ; offset += length ; wbytes -= length ; } }
/* (non-Javadoc)
@see java.io.OutputStream#write(byte[], int, int)