private void writeRawBytesInternal(final ByteBuffer value) throws IOException {
  int length=value.remaining();
  if (limit - position >= length) {
    value.get(buffer,position,length);
    position+=length;
    totalBytesWritten+=length;
  }
 else {
    final int bytesWritten=limit - position;
    value.get(buffer,position,bytesWritten);
    length-=bytesWritten;
    position=limit;
    totalBytesWritten+=bytesWritten;
    refreshBuffer();
    while (length > limit) {
      value.get(buffer,0,limit);
      output.write(buffer,0,limit);
      length-=limit;
      totalBytesWritten+=limit;
    }
    value.get(buffer,0,length);
    position=length;
    totalBytesWritten+=length;
  }
}

private void writeRawBytesInternal ( final ByteBuffer value ) throws IOException { int length = value . remaining ( ) ; if ( limit - position >= length ) { value . get ( buffer , position , length ) ; position += length ; totalBytesWritten += length ; } else { final int bytesWritten = limit - position ; value . get ( buffer , position , bytesWritten ) ; length -= bytesWritten ; position = limit ; totalBytesWritten += bytesWritten ; refreshBuffer ( ) ; while ( length > limit ) { value . get ( buffer , 0 , limit ) ; output . write ( buffer , 0 , limit ) ; length -= limit ; totalBytesWritten += limit ; } value . get ( buffer , 0 , length ) ; position = length ; totalBytesWritten += length ; } }
write a bytebuffer that isn ' t backed by an array .
