code: public String getPrefixedString(int fieldSize, Charset cs) {
          
          int len = 0;
          switch (fieldSize) {
          case 1:
              len = _buf.get();
              break;
          case 2:
              len = _buf.getShort();
              break;
          case 4:
              len = _buf.getInt();
              break;
          default:
              throw new IllegalArgumentException("Illegal argument, field size should be 1,2 or 4 and fieldSize is: " + fieldSize);
          }
  
          if (len == 0) {
              return "";
          }
  
          int oldLimit = _buf.limit();
          try {
              _buf.limit(_buf.position() + len);
              byte[] bytes = new byte[len];
              _buf.get(bytes, 0, len);
              String retVal = cs.decode(java.nio.ByteBuffer.wrap(bytes)).toString();
              return retVal;
          } finally {
              _buf.limit(oldLimit);
          }
      }
docs: Returns a length-prefixed string from the buffer at the current position.
  
  @param fieldSize the width in bytes of the prefixed length field
  @param cs the character set
  
  @return the length-prefixed string