public void write(@NotNull DataOutputStream out) throws IOException {
    out.writeUTF(getPath());

    try (BufferExposingByteArrayOutputStream bs = new BufferExposingByteArrayOutputStream();
         ObjectOutputStream os = new ObjectOutputStream(bs)) {
      os.writeObject(myState);

      out.writeInt(bs.size());
      out.write(bs.getInternalBuffer(), 0, bs.size());
    }
  }
public void write(@NotNull DataOutputStream out)