public static @Nullable MavenProject read(DataInputStream in) throws IOException {
    String path = in.readUTF();
    int length = in.readInt();
    byte[] bytes = new byte[length];
    in.readFully(bytes);

    // should read full byte content first!!!

    VirtualFile file = LocalFileSystem.getInstance().findFileByPath(path);
    if (file == null) return null;

    try (ByteArrayInputStream bs = new ByteArrayInputStream(bytes);
         ObjectInputStream os = new ObjectInputStream(bs)) {
      MavenProject result = new MavenProject(file);
      result.myState = (State)os.readObject();
      return result;
    }
    catch (ClassNotFoundException e) {
      throw new IOException(e);
    }
  }
public static @Nullable MavenProject read(DataInputStream in)