code: private static String readString(DataInput reader) throws IOException {
  		int blocks = reader.readUnsignedByte();
  		int bitMask = blocks & 0xC0;
  		if (bitMask == 0x40) {
  			// Blocks are in 2 bytes.
  			blocks = ((0x3F & blocks) << 8) | reader.readUnsignedByte();
  		} else if (bitMask == 0x80) {
  			// Blocks are in 3 bytes.
  			blocks = ((0x3F & blocks) << 16) | (reader.readUnsignedByte() << 8) | reader.readUnsignedByte();
  		} else if (bitMask == 0xC0) {
  			// Blocks are in 4 bytes.
  			blocks = ((0x3F & blocks) << 24) | (reader.readUnsignedByte() << 16) | (reader.readUnsignedByte() << 8) | reader.readUnsignedByte();
  		}
  		String result;
  		if (blocks == 0) {
  			result = null;
  		} else if (blocks < 0) {
  			throw new DeserializerException("Wrong 'null' indicator for a string", "0", Integer.toString(blocks));
  		} else {
  			StringBuilder sb = new StringBuilder();
  			for (int i=0; i<blocks; i++) {
  				sb.append(reader.readUTF());
  			}
  			result = sb.toString();
  		}
  		return result;
  	}
docs: /*
  Deserialize string. Make sure <code>null</code> is handled properly.