public class PrintOutput extends OutputStream
Modifier and Type | Field and Description |
---|---|
protected long |
max
Maximum numbers of bytes to write.
|
protected OutputStream |
os
Output stream reference (can be
null ). |
protected long |
size
Number of bytes written.
|
Constructor and Description |
---|
PrintOutput(IOFile file)
Constructor, given a filename.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
finished()
Checks if the output stream is exhausted.
|
void |
flush() |
static PrintOutput |
get(OutputStream out)
Returns a new instance for the given output stream.
|
void |
print(byte[] token)
Prints a token to the output stream.
|
void |
print(int cp)
Prints a single codepoint.
|
void |
print(String string)
Prints a string to the output stream.
|
void |
println(byte[] token)
Prints a token to the output stream, followed by a system-specific newline.
|
void |
println(String string)
Prints a string and newline to the output stream.
|
void |
setLimit(int limit)
Sets the maximum number of bytes to be written.
|
long |
size()
Returns the number of written bytes.
|
void |
write(int b) |
write, write
protected final OutputStream os
null
).protected long max
protected long size
public PrintOutput(IOFile file) throws IOException
file
- fileIOException
- I/O exceptionpublic static PrintOutput get(OutputStream out)
out
- output stream referencepublic final void setLimit(int limit)
limit
- maximumpublic void write(int b) throws IOException
write
in class OutputStream
IOException
public void print(int cp) throws IOException
cp
- codepoint to be printedIOException
- I/O exceptionpublic void print(byte[] token) throws IOException
token
- token to be writtenIOException
- I/O exceptionpublic void print(String string) throws IOException
string
- string to be writtenIOException
- I/O exceptionpublic final void println(String string) throws IOException
string
- string to be writtenIOException
- I/O exceptionpublic final void println(byte[] token) throws IOException
token
- token to be writtenIOException
- I/O exceptionpublic final long size()
public final void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public final void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public boolean finished()
true
if stream is exhaustedCopyright © 2005–2019 BaseX Team. All rights reserved.