Package com.unascribed.ears.common.util
Class BitInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.unascribed.ears.common.util.BitInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidalign()Aligns the read marker to the start of the next byte.voidclose()Closes this Stream.intread()Reads the next byte of data from the stream.intread(int bits) intreadBit()booleanlongreadL(int bits) intreadSAM(int bits) Reads a sign-and-magnitude signed number of the given length (excluding sign bit)floatreadSAMUnit(int bits) Reads a sign-and-magnitude signed number of the given length (excluding sign bit), then divides it by the max value, giving a unit value from -1 to 1.floatreadUnit(int bits) Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, read, reset, skipMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
BitInputStream
-
-
Method Details
-
readBit
- Throws:
IOException
-
readBoolean
- Throws:
IOException
-
read
Reads the next byte of data from the stream. As per the InputStream contract, if the end of the stream has been reached, -1 is returned. No guarantees are made about byte alignment unlessalign()has been called since the last bitwise read operation.- Overrides:
readin classFilterInputStream- Throws:
IOException
-
readL
- Throws:
IOException
-
read
- Throws:
IOException
-
readSAM
Reads a sign-and-magnitude signed number of the given length (excluding sign bit)- Throws:
IOException
-
readSAMUnit
Reads a sign-and-magnitude signed number of the given length (excluding sign bit), then divides it by the max value, giving a unit value from -1 to 1.- Throws:
IOException
-
readUnit
- Throws:
IOException
-
align
Aligns the read marker to the start of the next byte. If the marker is already at the beginning of a byte, this method does nothing.- Throws:
IOException
-
close
Closes this Stream. Also closes the underlying Stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException
-