MCPcopy Index your code
hub / github.com/Gagravarr/VorbisJava / read

Method read

core/src/main/java/org/gagravarr/ogg/BitsReader.java:36–60  ·  view source on GitHub ↗
(int numBits)

Source from the content-addressed store, hash-verified

34 }
35
36 public int read(int numBits) throws IOException {
37 int res = 0;
38 while (numBits > 0 && !eof) {
39 if (remaining == 0) {
40 tmp = input.read();
41 if (tmp == -1) {
42 eof = true;
43 return -1;
44 }
45 remaining = 8;
46 }
47 int toNibble = Math.min(remaining, numBits);
48 int toLeave = (remaining-toNibble);
49 int leaveMask = (1<<toLeave)-1;
50
51 res = res << toNibble;
52 res += (tmp>>toLeave);
53 tmp = tmp & leaveMask;
54
55 remaining -= toNibble;
56 numBits -= toNibble;
57 }
58 if (eof) return -1;
59 return res;
60 }
61
62 /**
63 * Counts the number of bits until the next zero (false)

Callers 15

testBitsReaderSimpleMethod · 0.95
FlacAudioFrameMethod · 0.95
bitsToNextZeroMethod · 0.95
bitsToNextOneMethod · 0.95
readToByteBoundaryMethod · 0.95
testEmptyPagesMethod · 0.45
testReadWriteContentsMethod · 0.45
testPagesMethod · 0.45
testCRCMethod · 0.45
testCRCProblemMethod · 0.45
testPagesMethod · 0.45
getNextAudioPacketMethod · 0.45

Calls

no outgoing calls

Tested by 7

testBitsReaderSimpleMethod · 0.76
testEmptyPagesMethod · 0.36
testReadWriteContentsMethod · 0.36
testPagesMethod · 0.36
testCRCMethod · 0.36
testCRCProblemMethod · 0.36
testPagesMethod · 0.36