chord.util
Class ByteBufferedFile

java.lang.Object
  extended by chord.util.ByteBufferedFile

public class ByteBufferedFile
extends java.lang.Object

Implementation of a buffered input or output file stream of bytes.

Author:
Mayur Naik (mhn@cs.stanford.edu)

Constructor Summary
ByteBufferedFile(int fileBlockSize, java.lang.String fileName, boolean isRead)
           
 
Method Summary
static int assemble(byte b1, byte b2, byte b3, byte b4)
           
 void eat(int n)
           
 void eatByte()
           
 void eatInt()
           
 void eatLong()
           
 void flush()
           
 byte getByte()
           
 int getInt()
           
 long getLong()
           
 java.lang.String getString()
           
 boolean isDone()
           
 void putByte(byte v)
           
 void putInt(int v)
           
 void putLong(long v)
           
 void putString(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteBufferedFile

public ByteBufferedFile(int fileBlockSize,
                        java.lang.String fileName,
                        boolean isRead)
                 throws java.io.IOException
Throws:
java.io.IOException
Method Detail

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

putByte

public void putByte(byte v)
             throws java.io.IOException
Throws:
java.io.IOException

getByte

public byte getByte()
             throws java.io.IOException,
                    ReadException
Throws:
java.io.IOException
ReadException

putInt

public void putInt(int v)
            throws java.io.IOException
Throws:
java.io.IOException

getInt

public int getInt()
           throws java.io.IOException,
                  ReadException
Throws:
java.io.IOException
ReadException

putLong

public void putLong(long v)
             throws java.io.IOException
Throws:
java.io.IOException

getLong

public long getLong()
             throws java.io.IOException,
                    ReadException
Throws:
java.io.IOException
ReadException

putString

public void putString(java.lang.String s)
               throws java.io.IOException
Throws:
java.io.IOException

getString

public java.lang.String getString()
                           throws java.io.IOException,
                                  ReadException
Throws:
java.io.IOException
ReadException

eatByte

public void eatByte()
             throws java.io.IOException,
                    ReadException
Throws:
java.io.IOException
ReadException

eatInt

public void eatInt()
            throws java.io.IOException,
                   ReadException
Throws:
java.io.IOException
ReadException

eat

public void eat(int n)
         throws java.io.IOException,
                ReadException
Throws:
java.io.IOException
ReadException

eatLong

public void eatLong()
             throws java.io.IOException,
                    ReadException
Throws:
java.io.IOException
ReadException

isDone

public boolean isDone()
               throws java.io.IOException
Throws:
java.io.IOException

assemble

public static int assemble(byte b1,
                           byte b2,
                           byte b3,
                           byte b4)