VorbisReader extends StreamReader { @VisibleForTesting static void appendNumberOfSamples( ParsableByteArray buffer, long packetSampleCount) { buffer.setLimit(buffer.limit() + 4); buffer.data[buffer.limit() - 4] = (byte) (packetSampleCount & 0xFF); buffer.data[buffer.limit() - 3] = (byte) ((packetSampleCount >>> 8) & 0xFF); buffer.data[buffer.limit() - 2] = (byte) ((packetSampleCount >>> 16) & 0xFF); buffer.data[buffer.limit() - 1] = (byte) ((packetSampleCount >>> 24) & 0xFF); }  static boolean verifyBitstreamType(ParsableByteArray data);  }
@Test public void testAppendNumberOfSamples() throws Exception { ParsableByteArray buffer = new ParsableByteArray(4); buffer.setLimit(0); VorbisReader.appendNumberOfSamples(buffer, 0x01234567); assertThat(buffer.limit()).isEqualTo(4); assertThat(buffer.data[0]).isEqualTo(0x67); assertThat(buffer.data[1]).isEqualTo(0x45); assertThat(buffer.data[2]).isEqualTo(0x23); assertThat(buffer.data[3]).isEqualTo(0x01); }