static String toString(@NotNull final Bytes buffer,long position,long len) throws BufferUnderflowException {
  final long pos=buffer.readPosition();
  final long limit=buffer.readLimit();
  buffer.readPositionRemaining(position,len);
  try {
    final StringBuilder builder=new StringBuilder();
    while (buffer.readRemaining() > 0) {
      builder.append((char)buffer.readByte());
    }
    return builder.toString();
  }
  finally {
    buffer.readLimit(limit);
    buffer.readPosition(pos);
  }
}

static String toString ( @ NotNull final Bytes buffer , long position , long len ) throws BufferUnderflowException { final long pos = buffer . readPosition ( ) ; final long limit = buffer . readLimit ( ) ; buffer . readPositionRemaining ( position , len ) ; try { final StringBuilder builder = new StringBuilder ( ) ; while ( buffer . readRemaining ( ) > 0 ) { builder . append ( ( char ) buffer . readByte ( ) ) ; } return builder . toString ( ) ; } finally { buffer . readLimit ( limit ) ; buffer . readPosition ( pos ) ; } }
the buffer is not modified by this call
