public static Offset fromBytes(DataInputStream stream) throws IOException {
    String name;
    long offset;
    int version = stream.readShort();
    switch (version) {
      case 0:
        name = Utils.readIntString(stream, StandardCharsets.UTF_8);
        offset = stream.readLong();
        break;
      default:
        throw new IllegalArgumentException("Unrecognized version [" + version + "] of Offset");
    }
    return new Offset(LogSegmentName.fromString(name), offset);
  }
Constructs an Offset from a stream.
@param stream the {@link DataInputStream} that will contain the serialized form of this object.
@throws IllegalArgumentException if {@code name} is {@code null} or {@code offset} < 0 or if the version
of the record is not recognized.
@throws IOException if there are I/O problems reading from the stream.
ambry-store/src/main/java/com/github/ambry/store/Offset.java