|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
java.io.BufferedOutputStream
FlexOr.io.CountedOutput
public class CountedOutput
CountedOutput extends the BufferedOutputStream by providing the features for counting characters and lines of output, and methods to output specific structures.
Constructor Summary | |
---|---|
CountedOutput(java.lang.String fileName)
Creating an instance of CountedOutput opens the named file. |
Method Summary | |
---|---|
int |
charCount()
Return the number of data characters written to the file. |
int |
getTabstopDist()
Return the tabstop distance. |
int |
lineCount()
Return the number of lines written to the file. |
int |
lineLength()
Return the number of characters written to the current line. |
void |
setTabstopDist(int newTabstop)
Set the tabstop distance. |
void |
write(byte[] buffer,
int offset,
int count)
Output a buffer of characters. |
void |
write(int theChar)
Output a single character |
void |
write(java.lang.String string)
Output a string. |
void |
writeInteger(int integer)
Output an integer in the minimum space. |
void |
writeInteger(int integer,
int width)
Requires: length(stringRep(integer)) <= width Ensures: output = output^spaces^stringRep(integer) #spaces = width - length(stringRep(integer)) charCount = width + old CharCount |
void |
writeln(java.lang.String string)
Output a string of characters followed by a newline. |
void |
writeNewline()
Output a newline character |
void |
writeNoCount(byte[] buffer,
int offset,
int count)
Output a buffer without adding to the lineLength. |
void |
writeNoCount(java.lang.String string)
Output a string without adding to the lineLength. |
Methods inherited from class java.io.BufferedOutputStream |
---|
flush |
Methods inherited from class java.io.FilterOutputStream |
---|
close, write |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CountedOutput(java.lang.String fileName) throws java.io.IOException
Requires: True Ensures: charChar = 0 and lineCount = 0
java.io.IOException
- When the output file cannot be created.Method Detail |
---|
public int charCount()
Requires: True
public int lineCount()
Requires: True
public int lineLength()
Requires: True
public int getTabstopDist()
Requires: True
public void setTabstopDist(int newTabstop)
Requires: True Ensures: tabstopDist = newTabstop
public void write(int theChar)
Requires: True Ensures: output = output^theChar charCount = 1 + oldCharCount
write
in class java.io.BufferedOutputStream
public void writeNewline()
Requires: True Ensures: output = output^Character.EOL theCharCount = 1 + old CharCount and lineCount = 1 + old lineCount
public void write(java.lang.String string)
Requires: True Ensures: output = output^string charCount = string.length + old CharCount lineCount = old lineCount + #(newLines in string)
public void writeln(java.lang.String string)
Requires: True Ensures: output = output^string^Character.EOL theCharCount = length(string) + 1 + old CharCount lineCount = 1 + old lineCount
public void writeNoCount(java.lang.String string)
Requires: True Ensures: output = output^string charCount = string.length() + old CharCount lineCount = old lineCount
public void write(byte[] buffer, int offset, int count)
Requires: True Ensures: output = output^buffer[offset .. offset+count-1] charCount = count + old CharCount lineCount = old lineCount + #(newLines in buffer[offset .. offset+count-1])
write
in class java.io.BufferedOutputStream
public void writeNoCount(byte[] buffer, int offset, int count)
Requires: True Ensures: output = output^buffer[offset .. offset+count-1] charCount = count + old CharCount lineCount = old lineCount
public void writeInteger(int integer)
Requires: True Ensures: output = output^stringRep(integer) theCharCount = length(stringRep(integer)) + old CharCount
public void writeInteger(int integer, int width)
Requires: length(stringRep(integer)) <= width Ensures: output = output^spaces^stringRep(integer) #spaces = width - length(stringRep(integer)) charCount = width + old CharCount
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |