|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Reader
java.io.InputStreamReader
com.ibm.as400.access.ConvTableReader
A ConvTableReader represents a Toolbox converter that uses stateful character conversion. That is, it wraps an underlying InputStream and reads/caches the appropriate number of bytes to return the requested number of Unicode characters. This is especially useful for mixed byte tables where the number of converted Unicode characters is almost never the same as the number of underlying EBCDIC bytes. This class exists primarily for use with the IFSText classes, but other components are free to use it as well.
ConvTableWriter
,
ReaderInputStream
Field Summary |
---|
Fields inherited from class java.io.Reader |
---|
lock |
Constructor Summary | |
---|---|
ConvTableReader(InputStream in)
Creates a ConvTableReader that uses the default character encoding. |
|
ConvTableReader(InputStream in,
int ccsid)
Creates a ConvTableReader that uses the specified CCSID. |
|
ConvTableReader(InputStream in,
int ccsid,
BidiConversionProperties properties)
Creates a ConvTableReader that uses the specified CCSID and bi-directional string type. |
|
ConvTableReader(InputStream in,
int ccsid,
int bidiStringType)
Creates a ConvTableReader that uses the specified CCSID and bi-directional string type. |
|
ConvTableReader(InputStream in,
int ccsid,
int bidiStringType,
int cacheSize)
Creates a ConvTableReader that uses the specified CCSID, bi-directional string type, and internal cache size. |
|
ConvTableReader(InputStream in,
String encoding)
Creates a ConvTableReader that uses the specified character encoding. |
Method Summary | |
---|---|
void |
close()
Closes this ConvTableReader and its underlying input stream. |
int |
getByteCacheSize()
Returns the maximum number of bytes that may be stored in the internal buffer. |
int |
getCacheSize()
Returns the maximum number of characters that may be stored in the internal buffer. |
int |
getCcsid()
Returns the CCSID used by this ConvTableReader. |
String |
getEncoding()
Returns the encoding used by this ConvTableReader. |
boolean |
markSupported()
ConvTableReader does not support the mark() operation. |
int |
read()
Reads a single character. |
int |
read(char[] buffer)
Reads characters into the specified array. |
int |
read(char[] buffer,
int offset,
int length)
Reads characters into a portion of the specified array. |
String |
read(int length)
Reads up to length characters out of the underlying stream. |
boolean |
ready()
Tells whether this ConvTableReader is ready to be read. |
long |
skip(long length)
Skips the specified number of characters in the underlying stream. |
Methods inherited from class java.io.Reader |
---|
mark, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ConvTableReader(InputStream in) throws UnsupportedEncodingException
in
- The InputStream from which to read characters.
UnsupportedEncodingException
- If the default character encoding or its associated CCSID is not supported.public ConvTableReader(InputStream in, String encoding) throws UnsupportedEncodingException
in
- The InputStream from which to read characters.encoding
- The name of a supported character encoding.
UnsupportedEncodingException
- If the specified character encoding or its associated CCSID is not supported.public ConvTableReader(InputStream in, int ccsid) throws UnsupportedEncodingException
in
- The InputStream from which to read characters.ccsid
- The CCSID.
UnsupportedEncodingException
- If the specified CCSID or its corresponding character encoding is not supported.public ConvTableReader(InputStream in, int ccsid, int bidiStringType) throws UnsupportedEncodingException
in
- The InputStream from which to read characters.ccsid
- The CCSID.bidiStringType
- The bi-directional string type
.
UnsupportedEncodingException
- If the specified CCSID or its corresponding character encoding is not supported.public ConvTableReader(InputStream in, int ccsid, BidiConversionProperties properties) throws UnsupportedEncodingException
in
- The InputStream from which to read characters.ccsid
- The CCSID.properties
- The bidi conversion properties.
UnsupportedEncodingException
- If the specified CCSID or its corresponding character encoding is not supported.public ConvTableReader(InputStream in, int ccsid, int bidiStringType, int cacheSize) throws UnsupportedEncodingException
in
- The InputStream from which to read characters.ccsid
- The CCSID.bidiStringType
- The bi-directional string type
.cacheSize
- The number of characters to store in the internal buffer. The default is 1024. This number must be greater than zero.
UnsupportedEncodingException
- If the specified CCSID or its corresponding character encoding is not supported.Method Detail |
public void close() throws IOException
IOException
- If an I/O exception occurs.public int getByteCacheSize()
public int getCacheSize()
getByteCacheSize()
.
public int getCcsid()
public String getEncoding()
public boolean markSupported()
public int read() throws IOException
IOException
- If an I/O exception occurs.public int read(char[] buffer) throws IOException
buffer
- The destination buffer.
IOException
- If an I/O exception occurs.public int read(char[] buffer, int offset, int length) throws IOException
buffer
- The destination buffer.offset
- The offset into the buffer at which to begin storing data.length
- The maximum number of characters to store.
IOException
- If an I/O exception occurs.public String read(int length) throws IOException
length
- The number of Unicode characters to return as a String. The number of bytes read from the underlying InputStream could be greater than length.
IOException
- If an I/O exception occurs.public boolean ready() throws IOException
IOException
- If an I/O exception occurs.public long skip(long length) throws IOException
length
- The number of characters to skip.
IOException
- If an I/O exception occurs.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |