| java.lang.Object tcl.lang.TclInputStream
TclInputStream | class TclInputStream (Code) | | |
Method Summary | |
void | close() | void | commonGetsCleanup() CommonGetsCleanup -> commonGetsCleanup
Helper function used by getsObj to restore the channel after
a "gets" operation. | static int | decodedNumBytes(ArrayList charToBytes, int start, int end) | int | doReadChars(TclObject obj, int toRead) DoReadChars -> doReadChars
Reads from the channel until the requested number of characters
have been seen, EOF is seen, or the channel would block. | boolean | eof() | int | externalToUnicode(byte[] src, int srcOff, int srcLen, char[] dst, int dstOff, int dstLen, IntPtr srcReadPtr, IntPtr dstWrotePtr, IntPtr dstCharsPtr, ArrayList charToBytes) Tcl_ExternalToUtf -> externalToUnicode
Convert a source buffer from the specified encoding into Unicode.
FIXME: Add doc for return values
src, Source bytes in specified encoding. | int | filterBytes(GetsState gs) FilterInputBytes -> filterBytes
Helper function for getsObj. | int | getNumBufferedBytes() Tcl_InputBuffered -> getNumBufferedBytes
Return the number of bytes that are current buffered. | int | getsObj(TclObject tobj) Tcl_GetsObj -> getsObj
Accumulate input from the input channel until end-of-line or
end-of-file has been seen. | boolean | isBlocked() | void | peekAhead(GetsState gs) PeekAhead -> peekAhead
Helper function used by getsObj. | int | readBytes(TclObject obj, int bytesToRead, IntPtr offsetPtr) ReadBytes -> readBytes
Reads from the channel until the requested number of
bytes have been seen, EOF is seen, or the channel would
block. | int | readChars(TclObject tobj, int charsToRead) ReadChars -> readChars
Reads from the channel until the requested number of
characters have been seen, EOF is seen, or the channel would
block. | boolean | sawCR() | void | seekReset() seekReset
Helper method used to reset state info when doing a seek. | void | setBlocking(boolean inBlocking) | void | setBufferSize(int inBufSize) | void | setBuffering(int inBuffering) | void | setEncoding(String inEncoding) | void | setEofChar(char inEofChar) | void | setTranslation(int inTranslation) | int | translateEOL(Object dstArray, int dstStart, Object srcArray, int srcStart, IntPtr dstLenPtr, IntPtr srcLenPtr) TranslateInputEOL -> translateEOL
Perform input EOL and EOF translation on the source buffer,
leaving the translated result in the destination buffer.
Results:
The return value is 1 if the EOF character was found when
copying bytes to the destination buffer, 0 otherwise. | void | updateInterest() UpdateInterest -> updateInterest
Arrange for the notifier to call us back at appropriate times
based on the current state of the channel. |
blocked | protected boolean blocked(Code) | | Blocked
|
blocking | protected boolean blocking(Code) | | Blocking
|
bufSize | protected int bufSize(Code) | | Buffer size in bytes
|
buffering | protected int buffering(Code) | | Buffering
|
csd | protected CharsetDecoder csd(Code) | | Charset decoder object. A null value means
that no conversions have been done yet.
|
encoding | protected String encoding(Code) | | Name of Java encoding for this Channel.
A null value means use no encoding (binary).
|
encodingEnd | boolean encodingEnd(Code) | | |
encodingStart | boolean encodingStart(Code) | | Flags used to track encoding states.
The encodingState member of called inputEncodingState
in the C ChannelState type. The encodingStart and encodingEnd
members combined are called inputEncodingFlags
and have the bit values TCL_ENCODING_END and TCL_ENCODING_START.
|
needMoreData | protected boolean needMoreData(Code) | | |
needNL | protected boolean needNL(Code) | | Used to track EOL state
|
sawCR | protected boolean sawCR(Code) | | |
translation | protected int translation(Code) | | Translation mode for end-of-line character
|
TclInputStream | TclInputStream(InputStream inInput)(Code) | | Constructor for Tcl input stream class. We require
a byte stream source at init time, the stram can't
be changed after the TclInputStream is created.
|
commonGetsCleanup | void commonGetsCleanup()(Code) | | CommonGetsCleanup -> commonGetsCleanup
Helper function used by getsObj to restore the channel after
a "gets" operation.
|
decodedNumBytes | static int decodedNumBytes(ArrayList charToBytes, int start, int end)(Code) | | |
doReadChars | int doReadChars(TclObject obj, int toRead) throws IOException(Code) | | DoReadChars -> doReadChars
Reads from the channel until the requested number of characters
have been seen, EOF is seen, or the channel would block. EOL
and EOF translation is done. If reading binary data, the raw
bytes are wrapped in a Tcl byte array object. Otherwise, the raw
bytes are converted to characters using the channel's current
encoding and stored in a Tcl string object.
Parameters: obj - Input data is stored in this object. Parameters: toRead - Maximum number of characters to store,or -1 to read all available data (up to EOFor when channel blocks). |
externalToUnicode | int externalToUnicode(byte[] src, int srcOff, int srcLen, char[] dst, int dstOff, int dstLen, IntPtr srcReadPtr, IntPtr dstWrotePtr, IntPtr dstCharsPtr, ArrayList charToBytes)(Code) | | Tcl_ExternalToUtf -> externalToUnicode
Convert a source buffer from the specified encoding into Unicode.
FIXME: Add doc for return values
src, Source bytes in specified encoding. srcOff, First index in src input array. srcLen, Number of bytes in src buffer. dst, Array to store unicode characters in. dstOff, First available index in dst array. dstLen, Length of dst array. srcReadPtr, Filled with the number of bytes fromthe source string that were converted.This may be less than the original sourcelength if there was a problem convertingsome source characters. dstWrotePtr, Filled with the number of chars that werestored in the output buffer as a result ofthe conversion dstCharsPtr, Filled with the number of characters thatcorrespond to the bytes stored in theoutput buffer. charToBytes, Contains int's that are used to map convertedbytes to chars. Can be null. |
filterBytes | int filterBytes(GetsState gs)(Code) | | FilterInputBytes -> filterBytes
Helper function for getsObj. Appends Unicode characters
onto the TclObject associated with the GetsState after
converting them from raw bytes encoded in the Channel.
The StringBuffer inside a TclObject is modified directly.
Consumes available bytes from channel buffers. When channel
buffers are exhausted, reads more bytes from channel device into
a new channel buffer. It is the caller's responsibility to
free the channel buffers that have been exhausted.
The return value is -1 if there was an error reading from the
channel, 0 otherwise.
Status object keeps track of how much data from channel buffers
has been consumed and where characters should be stored.
|
getNumBufferedBytes | int getNumBufferedBytes()(Code) | | Tcl_InputBuffered -> getNumBufferedBytes
Return the number of bytes that are current buffered.
|
getsObj | int getsObj(TclObject tobj)(Code) | | Tcl_GetsObj -> getsObj
Accumulate input from the input channel until end-of-line or
end-of-file has been seen. Bytes read from the input channel
are converted to Unicode using the encoding specified by the
channel.
Returns the number of characters accumulated in the object
or -1 if error, blocked, or EOF. If -1, use Tcl_GetErrno()
to retrieve the POSIX error code for the error or condition
that occurred.
Will consume input from the channel.
On reading EOF, leave channel at EOF char.
On reading EOL, leave channel after EOL, but don't
return EOL in dst buffer.
|
isBlocked | boolean isBlocked()(Code) | | |
peekAhead | void peekAhead(GetsState gs)(Code) | | PeekAhead -> peekAhead
Helper function used by getsObj. Called when we've seen a
\r at the end of the string and want to look ahead one
character to see if it is a \n.
Characters read from the channel are appended to gs.obj
via the filterBytes method.
|
readBytes | int readBytes(TclObject obj, int bytesToRead, IntPtr offsetPtr)(Code) | | ReadBytes -> readBytes
Reads from the channel until the requested number of
bytes have been seen, EOF is seen, or the channel would
block. Bytes from the channel are stored in obj as a
ByteArray object. EOL and EOF translation are done.
'bytesToRead' can safely be a very large number because
space is only allocated to hold data read from the channel
as needed.
The return value is the number of bytes appended to
the object.
obj, the TclByteArrayObject we are operating on bytesToRead, Maximum number of bytes to store.Bytes are obtained from the firstbuffer in the queue -- even if this numberis larger than the number of bytes onlythe bytes from the first buffer are returned. Parameters: offsetPtr - On input, contains how many bytes ofobj have been used to hold data. Onoutput, how many bytes are now being used. |
readChars | int readChars(TclObject tobj, int charsToRead) throws IOException(Code) | | ReadChars -> readChars
Reads from the channel until the requested number of
characters have been seen, EOF is seen, or the channel would
block. Raw bytes from the channel are converted to characters
and stored in obj. EOL and EOF translation is done.
'charsToRead' can safely be a very large number because
space is only allocated to hold data read from the channel
as needed.
The return value is the number of characters appended to
the object.
obj, the TclByteArrayObject we are operating on charsToRead, Maximum number of chars to store.Chars are obtained from the firstbuffer in the queue -- even if this numberis larger than the number of chars onlythe chars from the first buffer are returned. |
seekReset | void seekReset()(Code) | | seekReset
Helper method used to reset state info when doing a seek.
|
setBlocking | void setBlocking(boolean inBlocking)(Code) | | |
setBufferSize | void setBufferSize(int inBufSize)(Code) | | |
setBuffering | void setBuffering(int inBuffering)(Code) | | |
setEofChar | void setEofChar(char inEofChar)(Code) | | |
setTranslation | void setTranslation(int inTranslation)(Code) | | |
translateEOL | int translateEOL(Object dstArray, int dstStart, Object srcArray, int srcStart, IntPtr dstLenPtr, IntPtr srcLenPtr)(Code) | | TranslateInputEOL -> translateEOL
Perform input EOL and EOF translation on the source buffer,
leaving the translated result in the destination buffer.
Results:
The return value is 1 if the EOF character was found when
copying bytes to the destination buffer, 0 otherwise.
dstArray, Output buffer to fill with translated bytes or chars. dstStart, First unused index in the dst output array. srcArray, Input buffer that holds the bytes or chars to translate srcStart, Index of first available byte in src array. dstLenPtr, On entry, the maximum length of outputbuffer in bytes or chars; must be <= srcLenPtr.i. Onexit, the number of bytes or chars actually used inoutput buffer. srcLenPtr, On entry, the length of source buffer.On exit, the number of bytes or chars read fromthe source buffer. |
updateInterest | void updateInterest()(Code) | | UpdateInterest -> updateInterest
Arrange for the notifier to call us back at appropriate times
based on the current state of the channel.
|
|
|