code: private long deserializeDataLength(DataInputStream dis) throws IOException {
          int dataLength = dis.readInt();
          if(dataLength == -1) {
              return dis.readLong();
          }
          return dataLength;
      }
docs: / -1 is serialized as an int before a long containing the actual length.