private void readObject(ObjectInputStream stream) throws java.io.IOException, 
  java.lang.ClassNotFoundException {
    stream.defaultReadObject();
    int size = stream.readInt();
    this.bytes = new byte[size];
    int index = 0, remainder = size;
    while (index < size) {
      int numOfBytes = stream.read(bytes, index, remainder);
      if (numOfBytes == -1) 
        throw new java.io.EOFException( "Unexpected EOF at index " + index + " of " + size);
      else {
        index += numOfBytes;
        remainder -= numOfBytes;
      }
    }
  }