class ClipboardStream extends Stream
Stream.PrintMode
Modifier and Type | Field and Description |
---|---|
private java.io.ByteArrayOutputStream |
buffer
The intermediate buffer for writing data into this stream.
|
private static int |
BUFFER_SIZE
The default buffer size
|
private java.nio.charset.Charset |
charset
The default charset
|
private java.io.OutputStreamWriter |
writer
Character stream encoder
|
binary, convert, CR, DELIM, doneIn, doneOut, EOF, increment, LF, MODE_EXPORT, MODE_PUT_CONTROL, MODE_PUT_NORMAL, MODE_PUT_UNFORMATTED, NEWLINE, NEWLINE_LEN, PAGED_DEFAULT, PIPE_BROKEN_MESSAGE, SET_PAGED_DEFAULT, sourceCp, targetCp
Constructor and Description |
---|
ClipboardStream()
Creates this instance.
|
Modifier and Type | Method and Description |
---|---|
void |
assign(Stream stream)
Assigns the internal stream reference to the given reference.
|
long |
available()
The number of bytes available to be immediately read without blocking.
|
void |
close()
Closes both the input and output streams and releases OS resources associated with it.
|
void |
closeIn()
Closes the input stream and releases OS resources associated with it.
|
void |
closeOut()
Closes the output stream and releases OS resources associated with it.
|
long |
getLen()
The length of the stream in bytes.
|
long |
getPos()
The 0-based offset into the stream at which the next read or write will
occur.
|
boolean |
isIn()
State of the input side of the stream.
|
boolean |
isOut()
State of the output side of the stream.
|
int |
peekCh()
Peeks at the character from the current read position in the stream (reads a character from
the current read position in the stream without incrementing stream read position.
|
int |
readCh()
Read a character from the current read position in the stream and increment stream pointer.
|
java.lang.String |
readLn()
Read all characters from the current read position in the stream to the
next line separator (as determined by the
File.separator
or to the EOF . |
void |
setLen(long len)
Truncates or extends the stream to the specified length if this stream
supports such an operation.
|
void |
setPos(long pos)
Moves the current read/write position to the specified absolute 0-based
offset.
|
void |
write(byte[] data)
Write the given byte array to the output stream.
|
void |
write(byte[] data,
int off,
int len)
Write the specified range of bytes from the given byte array to the output stream.
|
void |
write(java.lang.String data)
Write the given string to the output stream.
|
void |
writeByte(byte b)
Write the given byte to the output stream.
|
void |
writeCh(char ch)
Write the given character to the output stream.
|
advancePage, afterWrite, assignDatum, cleanup, deleted, deregisterFooter, deregisterHeader, endOutput, endOutput, export, finished, flush, flushControlled, flushData, forcePageBreak, forcePageBreak, generateStringFormat, getAvailableLines, getControl, getConvert, getDelimiter, getDisplayMode, getEcho, getEffectivePageSize, getLength, getName, getNextLineNum, getPageNum, getPageSize, getPendingRowCount, getPosition, getPulseOnClose, getUnformatted, hasPageHeadersFooters, indexOfNewLine, isContiguous, isFreshPage, isSilent, isSuppressFormFeed, isTerm, isUnbuffered, isUnnamed, isValid, iterate, needsHeadersOutput, needsPageBreak, needsPageBreak, processFooters, processHeaders, processHeadersInt, processHeadersUncond, protectReads, protectWrites, pulseOutput, put, putControl, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putLineEnd, putLineEnd, putNull, putNull, putSpace, putSpace, putUnformatted, putWorker, rawGetNextLineNum, rawGetPageNum, rawGetPageSize, rawIncrementNextLineNum, rawIncrementPageNum, rawNextLineNum, rawPageSize, rawResetNextLineNum, rawSetPageSize, readBlock, readChar, readChar, readChunk, readField, readField, readField, readField, readFieldWorker, readLine, readLineCleanup, registerAdvanceListener, registerCloseListener, registerFlushListener, registerFooter, registerHeader, registerPageBreakListener, resetCurrentLine, retry, setAppend, setBinary, setContiguous, setControl, setConvert, setConvertSource, setConvertSource, setConvertTarget, setConvertTarget, setDelimiter, setDelimiter, setEcho, setFont, setFont, setLandscape, setName, setPageSize, setPageSize, setPageSize, setPendingRowCount, setPortrait, setPosition, setPosition, setPulseOnClose, setUnbuffered, setUnformatted, setUnnamed, skipField, skipLoneHyphenInput, startOutput, writeBlock, writeControlled, writeControlledSpecial, writeField, writeField, writeField, writeField, writeField
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initFailure
private static int BUFFER_SIZE
private final java.nio.charset.Charset charset
private final java.io.ByteArrayOutputStream buffer
private final java.io.OutputStreamWriter writer
public long available() throws java.io.IOException
public long getPos() throws java.lang.UnsupportedOperationException, java.io.IOException
public void setPos(long pos) throws java.lang.UnsupportedOperationException, java.io.IOException
This does not work for "streams" that require sequential access.
public long getLen() throws java.lang.UnsupportedOperationException, java.io.IOException
public void setLen(long len) throws java.lang.UnsupportedOperationException, java.io.IOException
public void writeCh(char ch) throws java.io.IOException
public void writeByte(byte b) throws java.io.IOException
public void write(java.lang.String data) throws java.io.IOException
public void write(byte[] data) throws java.io.IOException
public void write(byte[] data, int off, int len) throws java.io.IOException
write
in class Stream
data
- The data to be written.off
- Starting offset in data from which to read bytes to be written. Must be
non-negative and < data.length
.len
- Length of data to be written. Must be non-negative and <=
(data.length - offset)
.java.io.IOException
- If an I/O error occurs.public int peekCh()
peekCh()
and readCh()
will return the same value).
The underlying stream subclass determines the content of the result. Byte oriented streams such as pipes or files will return a byte while streams that generate keystrokes or characters may return a DBCS or Unicode character.
public int readCh()
The underlying stream subclass determines the content of the result. Byte oriented streams such as pipes or files will return a byte while streams that generate keystrokes or characters may return a DBCS or Unicode character.
public java.lang.String readLn() throws java.io.EOFException, java.io.IOException, java.lang.InterruptedException
File.separator
or to the EOF
. Any line separator character(s) and the
EOF
character are not returned.readLn
in class Stream
java.io.IOException
- If an I/O error occurs.java.io.EOFException
- If this input stream reaches the end before reading all the bytes.java.lang.InterruptedException
- If any thread interrupted the current thread before or while the current thread
was waiting for a notification.public void closeIn()
public void closeOut()
public void close()
public boolean isIn()
public boolean isOut()
public void assign(Stream stream) throws java.lang.UnsupportedOperationException