code: public static String readString(DataInput in) throws IOException {
          int b=in.readByte();
          if(b == 1)
              return in.readUTF();
          return null;
      }
docs: Reads a string from buf. The length is read first, followed by the chars. Each char is a single byte
  @param in the input stream
  @return the string read from buf