public GeometryCompressor() {
    // Create a compressed geometry header.
    cgHeader = new CompressedGeometryData.Header();

    // v1.0.0 - pre-FCS
    // v1.0.1 - fixed winding order, FCS version (J3D 1.1.2)
    // v1.0.2 - normal component length maximum 6, LII hardware (J3D 1.2)
    cgHeader.majorVersionNumber = 1;
    cgHeader.minorVersionNumber = 0;
    cgHeader.minorMinorVersionNumber = 2;
  }
  //
  // Compress the stream and put the results in the output buffer.
  // Set up the CompressedGeometryData.Header object.
  //
  private void compressStream(CompressionStream stream) {
    if (benchmark) startTime = System.currentTimeMillis();

    // Create the Huffman table.
    huffmanTable = new HuffmanTable();

    // Quantize the stream, compute deltas between consecutive elements if
    // possible, and histogram the data length distribution.
    stream.quantize(huffmanTable);

    // Compute tags for stream tokens.
    huffmanTable.computeTags();

    // Create the output buffer and assemble the compressed output.
    outputBuffer = new CommandStream(stream.getByteCount() / 3);
    stream.outputCommands(huffmanTable, outputBuffer);

    // Print any desired info.
    if (benchmark) printBench(stream);
    if (printStream) stream.print();
    if (printHuffman) huffmanTable.print();

    // Set up the compressed geometry header object.
    cgHeader.bufferType = stream.streamType;
    cgHeader.bufferDataPresent = 0;
    cgHeader.lowerBound = new Point3d(stream.ncBounds[0]);
    cgHeader.upperBound = new Point3d(stream.ncBounds[1]);

    if (stream.vertexNormals)
      cgHeader.bufferDataPresent |= CompressedGeometryData.Header.NORMAL_IN_BUFFER;

    if (stream.vertexColor3 || stream.vertexColor4)
      cgHeader.bufferDataPresent |= CompressedGeometryData.Header.COLOR_IN_BUFFER;

    if (stream.vertexColor4)
      cgHeader.bufferDataPresent |= CompressedGeometryData.Header.ALPHA_IN_BUFFER;

    cgHeader.start = 0;
    cgHeader.size = outputBuffer.getByteCount();

    // Clear the huffman table for next use.
    huffmanTable.clear();
  }