Class OggTrailer

java.lang.Object
me.hackware.api.util.OggTrailer

public final class OggTrailer extends Object
Trims anything appended after the last complete Ogg page.

The auth server appends an HWID leak tracker to the bundled .ogg assets in release builds. Vorbis decoders choke on the trailing garbage, so it has to come off before the file reaches JOrbisAudioStream.

Rather than scanning for the tracker's magic bytes (which can and does false positive inside compressed audio), we walk the Ogg page chain from the start and cut at the end of the last well-formed page. That is exact regardless of what the server appended, and a no-op on untracked files.

  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    trim(byte[] data)
    Returns data truncated to the end of its last complete Ogg page, or data itself when there is nothing to trim (or it isn't an Ogg stream at all).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • trim

      public static byte[] trim(byte[] data)
      Returns data truncated to the end of its last complete Ogg page, or data itself when there is nothing to trim (or it isn't an Ogg stream at all).