|
|||||||||
| Home >> All >> com >> anotherbigidea >> [ io overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.anotherbigidea.io
Class OutStream

java.lang.Objectjava.io.OutputStream
com.anotherbigidea.io.CountingOutputStream
com.anotherbigidea.io.OutputStreamWrapper
com.anotherbigidea.io.OutStream
- public class OutStream
- extends OutputStreamWrapper
Output Stream Wrapper
| Field Summary | |
private int |
mBitBuf
|
private int |
mBitPos
|
| Fields inherited from class com.anotherbigidea.io.OutputStreamWrapper |
|
| Fields inherited from class com.anotherbigidea.io.CountingOutputStream |
mCount |
| Constructor Summary | |
protected |
OutStream()
|
|
OutStream(java.io.OutputStream out)
|
| Method Summary | |
void |
close()
Override to ensure that bits are flushed |
static int |
determineSignedBitSize(int value)
Determine the minimum number of bits required to hold the given signed value |
static int |
determineUnsignedBitSize(long value)
Determine the minimum number of bits required to hold the given unsigned value (may be zero) |
void |
flush()
This method forces any data that may have been buffered to be written to the underlying output device. |
void |
flushBits()
Flush the bit buffer to the output stream and reset values |
static boolean |
getBit(int bitNum,
long value)
Get the given bit (where lowest bit is numbered 1) |
static int |
getStringLength(byte[] string)
Calculate the byte length of a string as it would be written to the output stream |
static int |
getStringLength(java.lang.String string)
Calculate the byte length of a string as it would be written to the output stream using the default character encoding |
private void |
initBits()
Reset the bit buffer |
static int |
setBit(int bitNum,
int value)
Set the given bit (where lowest bit is numbered 1) |
static byte[] |
sintTo2Bytes(int value)
Util to convert a signed int to 2 bytes |
static byte[] |
uintTo2Bytes(int value)
Util to convert an unsigned int to 2 bytes |
static byte[] |
uintTo4Bytes(int value)
Util to convert an unsigned int to 4 bytes |
static byte |
uintToByte(int value)
Util to convert an unsigned int to an unsigned byte |
void |
write(byte[] bytes)
Write the given bytes to the output stream |
void |
write(byte[] bytes,
int start,
int length)
Write the given bytes to the output stream |
void |
write(int b)
This method writes a single byte to the output stream. |
void |
writeCompressed()
Compress all subsequent data |
void |
writeDouble(double value)
Write a double value |
void |
writeFloat(float value)
Write a float value |
void |
writeSBits(int numBits,
int value)
Write a signed value to the output stream in the given number of bits. |
void |
writeSI16(short value)
Write a 16 bit signed value to the out stream |
void |
writeSI32(int value)
Write a 32 bit signed value |
void |
writeString(byte[] string)
Write a string to the output stream and add terminating null |
void |
writeString(java.lang.String s,
java.lang.String encoding)
Write a string to the output stream using the default encoding and add terminating null |
void |
writeUBits(int numBits,
long value)
Write an unsigned value to the output stream in the given number of bits |
void |
writeUI16(int value)
Write a 16 bit unsigned value to the out stream |
void |
writeUI32(long value)
Write a 32 bit unsigned value to the out stream |
void |
writeUI8(int value)
Write an 8 bit unsigned value to the out stream |
| Methods inherited from class com.anotherbigidea.io.OutputStreamWrapper |
getOutputStream, setOutputStream |
| Methods inherited from class com.anotherbigidea.io.CountingOutputStream |
getCount, setCount |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
mBitBuf
private int mBitBuf
mBitPos
private int mBitPos
| Constructor Detail |
OutStream
public OutStream(java.io.OutputStream out)
OutStream
protected OutStream()
| Method Detail |
writeSBits
public void writeSBits(int numBits,
int value)
throws java.io.IOException
- Write a signed value to the output stream in the given number of bits.
The value must actually fit in that number of bits or it will be garbled
flush
public void flush()
throws java.io.IOException
- Description copied from class:
java.io.OutputStream - This method forces any data that may have been buffered to be written
to the underlying output device. Please note that the host environment
might perform its own buffering unbeknowst to Java. In that case, a
write made (for example, to a disk drive) might be cached in OS
buffers instead of actually being written to disk.
This method in this class does nothing.
- Overrides:
flushin classOutputStreamWrapper
writeCompressed
public void writeCompressed()
- Compress all subsequent data
flushBits
public void flushBits()
throws java.io.IOException
- Flush the bit buffer to the output stream and reset values
writeUBits
public void writeUBits(int numBits,
long value)
throws java.io.IOException
- Write an unsigned value to the output stream in the given number of bits
getBit
public static boolean getBit(int bitNum,
long value)
- Get the given bit (where lowest bit is numbered 1)
setBit
public static int setBit(int bitNum,
int value)
- Set the given bit (where lowest bit is numbered 1)
write
public void write(byte[] bytes)
throws java.io.IOException
- Write the given bytes to the output stream
- Overrides:
writein classOutputStreamWrapper
write
public void write(byte[] bytes,
int start,
int length)
throws java.io.IOException
- Write the given bytes to the output stream
- Overrides:
writein classOutputStreamWrapper
writeUI8
public void writeUI8(int value)
throws java.io.IOException
- Write an 8 bit unsigned value to the out stream
writeUI16
public void writeUI16(int value)
throws java.io.IOException
- Write a 16 bit unsigned value to the out stream
writeSI16
public void writeSI16(short value)
throws java.io.IOException
- Write a 16 bit signed value to the out stream
writeUI32
public void writeUI32(long value)
throws java.io.IOException
- Write a 32 bit unsigned value to the out stream
writeString
public void writeString(java.lang.String s, java.lang.String encoding) throws java.io.IOException
- Write a string to the output stream using the default encoding and add terminating null
writeString
public void writeString(byte[] string)
throws java.io.IOException
- Write a string to the output stream and add terminating null
getStringLength
public static int getStringLength(byte[] string)
- Calculate the byte length of a string as it would be written to the
output stream
getStringLength
public static int getStringLength(java.lang.String string)
- Calculate the byte length of a string as it would be written to the
output stream using the default character encoding
initBits
private void initBits()
- Reset the bit buffer
determineSignedBitSize
public static int determineSignedBitSize(int value)
- Determine the minimum number of bits required to hold the given
signed value
determineUnsignedBitSize
public static int determineUnsignedBitSize(long value)
- Determine the minimum number of bits required to hold the given
unsigned value (may be zero)
writeFloat
public void writeFloat(float value)
throws java.io.IOException
- Write a float value
writeDouble
public void writeDouble(double value)
throws java.io.IOException
- Write a double value
writeSI32
public void writeSI32(int value)
throws java.io.IOException
- Write a 32 bit signed value
sintTo2Bytes
public static byte[] sintTo2Bytes(int value)
- Util to convert a signed int to 2 bytes
uintTo2Bytes
public static byte[] uintTo2Bytes(int value)
- Util to convert an unsigned int to 2 bytes
uintTo4Bytes
public static byte[] uintTo4Bytes(int value)
- Util to convert an unsigned int to 4 bytes
uintToByte
public static byte uintToByte(int value)
- Util to convert an unsigned int to an unsigned byte
write
public void write(int b)
throws java.io.IOException
- Description copied from class:
java.io.OutputStream - This method writes a single byte to the output stream. The byte written
is the low eight bits of the
intpassed and a argument.Subclasses must provide an implementation of this abstract method
- Overrides:
writein classOutputStreamWrapper
close
public void close()
throws java.io.IOException
- Override to ensure that bits are flushed
- Overrides:
closein classOutputStreamWrapper
|
|||||||||
| Home >> All >> com >> anotherbigidea >> [ io overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC