Methods Summary |
---|
public byte[] | read(int payloadSize)
byte[] result = new byte[payloadSize];
for (int i = 0; i < payloadSize; i++) {
result[i] = (byte) readByte();
}
return result;
|
public boolean | readAE()
// TODO: do it!!
throw new UnsupportedOperationException("Stan");
|
public int | readAEI()
// TODO: do it!!
throw new UnsupportedOperationException("Stan");
|
public boolean | readBool(java.lang.String message)
boolean res = read1Bit() == 0 ? false : true;
trace(message, res ? "1" : "0");
return res;
|
public java.lang.Object | readCE(com.googlecode.mp4parser.h264.BTree bt, java.lang.String message)
while (true) {
int bit = read1Bit();
bt = bt.down(bit);
if (bt == null) {
throw new RuntimeException("Illegal code");
}
Object i = bt.getValue();
if (i != null) {
trace(message, i.toString());
return i;
}
}
|
public int | readME(java.lang.String string)
return readUE(string);
|
public long | readNBit(int n, java.lang.String message)
long val = readNBit(n);
trace(message, String.valueOf(val));
return val;
|
public int | readSE(java.lang.String message)
int val = readUE();
int sign = ((val & 0x1) << 1) - 1;
val = ((val >> 1) + (val & 0x1)) * sign;
trace(message, String.valueOf(val));
return val;
|
public int | readTE(int max)
if (max > 1)
return readUE();
return ~read1Bit() & 0x1;
|
public void | readTrailingBits()
read1Bit();
readRemainingByte();
|
public int | readU(int i, java.lang.String string)
return (int) readNBit(i, string);
|
private int | readUE()Read unsigned exp-golomb code
int cnt = 0;
while (read1Bit() == 0)
cnt++;
int res = 0;
if (cnt > 0) {
long val = readNBit(cnt);
res = (int) ((1 << cnt) - 1 + val);
}
return res;
|
public int | readUE(java.lang.String message)
int res = readUE();
trace(message, String.valueOf(res));
return res;
|
public int | readZeroBitCount(java.lang.String message)
int count = 0;
while (read1Bit() == 0)
count++;
trace(message, String.valueOf(count));
return count;
|
private void | trace(java.lang.String message, java.lang.String val)
StringBuilder traceBuilder = new StringBuilder();
int spaces;
String pos = String.valueOf(bitsRead - debugBits.length());
spaces = 8 - pos.length();
traceBuilder.append("@" + pos);
for (int i = 0; i < spaces; i++)
traceBuilder.append(' ");
traceBuilder.append(message);
spaces = 100 - traceBuilder.length() - debugBits.length();
for (int i = 0; i < spaces; i++)
traceBuilder.append(' ");
traceBuilder.append(debugBits);
traceBuilder.append(" (" + val + ")");
debugBits.clear();
println(traceBuilder.toString());
|