|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BitOut
Interface describing the writing compression methods supported by the BitOutputStream classes. Integers written through these compression methods must be greater than 0.
Method Summary | |
---|---|
byte |
getBitOffset()
Returns the bit offset in the last byte. |
long |
getByteOffset()
Returns the byte offset of the stream. |
int |
writeBinary(int len,
int x)
Writes an integer in binary format to the stream. |
int |
writeDelta(int x)
Writes an integer x into the stream using delta encoding. |
int |
writeGamma(int x)
Writes an integer x into the stream using gamma encoding. |
int |
writeGolomb(int x,
int b)
Writes and integer x into the stream using golomb coding. |
int |
writeInt(int x,
int len)
Writes an integer x into the underlying OutputStream. |
int |
writeInterpolativeCode(int[] data,
int offset,
int len,
int lo,
int hi)
Writes a sequence of integers using interpolative coding. |
int |
writeMinimalBinary(int x,
int b)
Writes an integer x using minimal binary encoding, given an upper bound. |
int |
writeSkewedGolomb(int x,
int b)
Writes and integer x into the stream using skewed-golomb coding. |
int |
writeUnary(int x)
Writes an integer x using unary encoding. |
Methods inherited from interface java.io.Closeable |
---|
close |
Method Detail |
---|
long getByteOffset()
byte getBitOffset()
int writeUnary(int x) throws java.io.IOException
x
- the number to write
java.io.IOException
- if an I/O error occurs.int writeGamma(int x) throws java.io.IOException
x
- the int number to write
java.io.IOException
- if an I/O error occurs.int writeBinary(int len, int x) throws java.io.IOException
len
- size in bits of the number.x
- the integer to write.
java.io.IOException
- if an I/O error occurs.int writeInterpolativeCode(int[] data, int offset, int len, int lo, int hi) throws java.io.IOException
data
- the vector containing the integer sequence.offset
- the offset into data
where the sequence starts.len
- the number of integers to code.lo
- a lower bound (must be smaller than or equal to the first integer in the sequence).hi
- an upper bound (must be greater than or equal to the last integer in the sequence).
java.io.IOException
- if an I/O error occurs.int writeSkewedGolomb(int x, int b) throws java.io.IOException
v = <b, 2b, 4b, ... , 2^i b, ...>
an integer x
is coded as unary(k+1)
where k
is the index
sum(i=0)(k) v_i < x <= sum(i=0)(k+1)
k = log(x/b + 1)
sum_i = b(2^n -1)
(geometric progression)
and the remainder with log(v_k)
bits in binary
if lower = ceil(x/b) -> lower = 2^i * b -> i = log(ceil(x/b)) + 1
the remainder x - sum_i 2^i*b - 1 = x - b(2^n - 1) - 1
is coded with floor(log(v_k))
bits
This method is not failsafe, it doesn't check if the argument or the modulus is 0 or negative.
x
- the number to writeb
- the parameter for golomb coding
java.io.IOException
- if and I/O error occursint writeGolomb(int x, int b) throws java.io.IOException
x
- the number to writeb
- the parameter for golomb coding
java.io.IOException
- if and I/O error occursint writeMinimalBinary(int x, int b) throws java.io.IOException
x
- the number to writeb
- and strict bound for x
java.io.IOException
- if an I/O error occurs.int writeDelta(int x) throws java.io.IOException
x
- the int number to write
java.io.IOException
- if an I/O error occurs.int writeInt(int x, int len) throws java.io.IOException
x
- the int to writelen
- length of the int in bits
java.io.IOException
- if an I/O error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |