All Implemented Interfaces:
FileProtocol

public class PF2 extends ProjectFile
PF2 is a J3D file protocol implementation for reading and writing project files that contain layer and thing information to and from disk.

Typically .j3p files

This version is different from PF1 as it makes the following changes: (in the format 0xAARRGGBB)

The Exact format is as follows:

    J3D Header (UTF-8)
    J3D Version (int)
    PROJECT Header (UTF-8)
    PROJECT Header Version (int)
    Number of Layers (int)
    For each Layer:
      Layer Identifier (UTF-8)
      Layer Hidden (boolean)
    Number of points in project (int)
    For each point:
      Point UUID (UTF-8)
      Thing Parent UUID (UTF-8)
      X Coordinate (double)
      Y Coordinate (double)
      Z Coordinate (double)
      Point Colour (signed 32 bit int) (Different from PF1)
    Number of lines in project (int)
    For each line:
      Line UUID (UTF-8)
      Thing Parent UUID (UTF-8)
      Line Colour (signed 32 bit int) (Different from PF1)
      Start Point UUID (UTF-8)
      End Point UUID (UTF-8)
    Number of triangles in project (int)
    For each triangle:
      Triangle UUID (UTF-8)
      Thing Parent UUID (UTF-8)
      Tri colour (signed 32 bit int) (Different from PF1)
      Line 1 UUID (UTF-8)
      Line 2 UUID (UTF-8)
      Line 3 UUID (UTF-8)
    For each Layer:
      Layer Index (int)
      Number of Things in Layer (int)
      For each Thing:
        Thing UUID (UTF-8)
        Thing Name (UTF-8)
        Thing Visibility (boolean)
        ... Multiple lines UUIDs of lines points and tris that the thing owns (UTF-8)

  • Constructor Details

    • PF2

      public PF2()
  • Method Details

    • writeFile

      public <T extends ArrayList> void writeFile(String path, String name, T data)
      Description copied from interface: FileProtocol
      Writes the provided data to a file at the specified path. This should be a direct inverse of the corresponding FileProtocol.readFile(String, String, Spinner) method.
      Specified by:
      writeFile in interface FileProtocol
      Overrides:
      writeFile in class ProjectFile
      Type Parameters:
      T - The type of the data to be written, which must extend ArrayList.
      Parameters:
      path - The path to the file to be written.
      data - The data to be written to the file.
    • msg

      private static void msg(String message)
    • readFile

      public <T extends ArrayList> T readFile(String path, String name, Spinner throbber) throws Exception
      Reads a project file from the specified path and constructs the entire project structure including layers and things.
      Specified by:
      readFile in interface FileProtocol
      Overrides:
      readFile in class ProjectFile
      Type Parameters:
      T - The type of ArrayList to be returned.
      Parameters:
      path - The path to the file to be read.
      name - The name of the file to be read.
      throbber - The Spinner instance
      Returns:
      An ArrayLit containing the success state of the read operation.
      Throws:
      Exception