assignment4
Class BitStreamUtility

java.lang.Object
  extended by assignment4.BitStreamUtility

public class BitStreamUtility
extends java.lang.Object

Some simple methods to read and write with bit streams. Also includes a main method that demonstrates functionality.


Constructor Summary
BitStreamUtility()
           
 
Method Summary
static java.lang.String bitsToBitString(java.io.InputStream inputStream)
          Reads each bit from input stream and returns a String representation of the bits
static java.lang.String bitsToCharString(java.io.InputStream inputStream)
          Reads each word-size chunk from input stream and returns a String representation
static void main(java.lang.String[] args)
           
static void writeBitStringToStream(java.lang.String binaryString, java.io.OutputStream out)
          Given a string of 0's and 1's, writes each character as a bit to output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitStreamUtility

public BitStreamUtility()
Method Detail

writeBitStringToStream

public static void writeBitStringToStream(java.lang.String binaryString,
                                          java.io.OutputStream out)
Given a string of 0's and 1's, writes each character as a bit to output stream.

Parameters:
binaryString - a string representing a sequence of bits
out - output stream to which bits are written

bitsToCharString

public static java.lang.String bitsToCharString(java.io.InputStream inputStream)
                                         throws java.io.IOException
Reads each word-size chunk from input stream and returns a String representation

Parameters:
inputStream -
Returns:
contents of input stream as a String
Throws:
java.io.IOException

bitsToBitString

public static java.lang.String bitsToBitString(java.io.InputStream inputStream)
                                        throws java.io.IOException
Reads each bit from input stream and returns a String representation of the bits

Parameters:
inputStream -
Returns:
contents of input stream as a String of binary (0's and 1's)
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException