|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBinaryFile
public class BinaryFile
Constructor Summary | |
---|---|
BinaryFile(java.lang.String filename,
char readOrWrite)
Binary File constructor. |
Method Summary | |
---|---|
void |
close()
Close the file (works for input and output files). |
boolean |
EndOfFile()
Checks to see if we are at the end of a file. |
boolean |
readBit()
Read a bit froman input file. |
char |
readChar()
Read in the next 8 bits to the input file, and interpret them as a character. |
void |
writeBit(boolean bit)
Write a bit to an output file This method is only valid for output files, and will halt execution if called on an input file. |
void |
writeChar(char c)
Write a character to an output file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BinaryFile(java.lang.String filename, char readOrWrite)
filename
- The name of the file to read from or write toreadOrWrite
- 'w' or 'W' for an output file (open for writing),
and 'r' or 'R' for an input file (open for reading)Method Detail |
---|
public boolean EndOfFile()
public char readChar()
public void writeChar(char c)
c
- The character to write to the output file.public void writeBit(boolean bit)
bit
- The bit to write. false writes a 0 and true writes a 1.public boolean readBit()
public void close()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |