Package eu.bandm.tools.tdom.runtime
Class EncodingOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
eu.bandm.tools.tdom.runtime.EncodingOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
DOCME
CHECK: Uses direct and inherited aggregation in parallel ? (=inherited and overwritten
methods?)
-
Field Summary
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) static int
bitWidth
(int w) DOCME nicht ganz klar was das soll? https://cmsdk.com/java/get-the-position-instead-of-the-value-of-the-highest-one-bit-in-integer-duplicate.html suggests int ho = Integer.highestOneBit(f) int pos = ho==0 ? 0 : Integer.numberOfTrailingZeros(ho)void
writeInt
(int min, int n) Write out "n" for a value which is always geq "min", but no upper limit is known.void
writeInt
(int n, int min, int max) Write out "n" for a value always geq "min" and leq "max".void
writeString
(String string) Write out a character sequence.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
EncodingOutputStream
-
-
Method Details
-
writeInt
Write out "n" for a value which is always geq "min", but no upper limit is known. Use a Fibonacci encoding = Zeckendorf representation: Each strictly positive integer is represented as a sum of Fibonacci numbers. Anywhere a sequence of digits "..011.." is canonically represented as "..100..", so never two adjacent one bits "11" do appear. The bits are written lowest to highest. The highest is always "1" and an additional stop bit "1" follows. E.g.1 2 5 8 13 stopbit 15 = 0 1 0 0 1 1
- Throws:
IOException
-
writeInt
Write out "n" for a value always geq "min" and leq "max". Writes out the relative position of "n" in this range. Writes out as many bits as necessary for this maximal position. Writes out epsilon (=the empty bitstring) iff only one value is possible ("min==max").- Throws:
IOException
-
bitWidth
static int bitWidth(int w) DOCME nicht ganz klar was das soll? https://cmsdk.com/java/get-the-position-instead-of-the-value-of-the-highest-one-bit-in-integer-duplicate.html suggests int ho = Integer.highestOneBit(f) int pos = ho==0 ? 0 : Integer.numberOfTrailingZeros(ho) -
writeString
Write out a character sequence. Write either only the index number into the constant pool, or define a new entry in this pool. The resp bit encodings are.:0
1 - Throws:
IOException
-