|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
org.apache.derby.iapi.types.ReaderToUTF8Stream
public final class ReaderToUTF8Stream
Converts a java.io.Reader to the on-disk UTF8 format used by Derby for character types.
| Field Summary | |
|---|---|
private int |
blen
|
private int |
boff
|
private byte[] |
buffer
|
private static int |
BUFSIZE
|
private int |
charsToTruncate
Number of characters to truncate from this stream The SQL standard allows for truncation of trailing spaces for clobs,varchar,char. |
private boolean |
eof
|
private int |
maximumLength
The maximum allowed length of the stream. |
private boolean |
multipleBuffer
|
private LimitReader |
reader
Application's reader wrapped in a LimitReader. |
private static char |
SPACE
|
private java.lang.String |
typeName
The type name for the column data is inserted into. |
private int |
valueLength
Length of the final value, after truncation if any, in characters. |
| Constructor Summary | |
|---|---|
ReaderToUTF8Stream(java.io.Reader appReader,
int valueLength,
int numCharsToTruncate,
java.lang.String typeName)
Create a stream that will truncate trailing blanks if required/allowed. |
|
ReaderToUTF8Stream(java.io.Reader appReader,
int maximumLength,
java.lang.String typeName)
Create a UTF-8 stream for a length less application reader. |
|
| Method Summary | |
|---|---|
int |
available()
Return an optimized version of bytes available to read from the stream Note, it is not exactly per java.io.InputStream#available() |
private boolean |
canTruncate()
Determine if trailing blank truncation is allowed. |
private void |
checkSufficientData()
Validate the length of the stream, take corrective action if allowed. |
void |
close()
return resources |
private void |
fillBuffer(int startingOffset)
|
int |
read()
read from stream; characters converted to utf-8 derby specific encoding. |
int |
read(byte[] b,
int off,
int len)
|
private void |
truncate()
Attempt to truncate the stream by removing trailing blanks. |
| Methods inherited from class java.io.InputStream |
|---|
mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private LimitReader reader
private byte[] buffer
private int boff
private int blen
private boolean eof
private boolean multipleBuffer
private static final int BUFSIZE
private final int charsToTruncate
private static final char SPACE
private final int valueLength
private final int maximumLength
private final java.lang.String typeName
| Constructor Detail |
|---|
public ReaderToUTF8Stream(java.io.Reader appReader,
int valueLength,
int numCharsToTruncate,
java.lang.String typeName)
appReader - application readervalueLength - the length of the reader in charactersnumCharsToTruncate - the number of trailing blanks to truncatetypeName - type name of the column data is inserted into
public ReaderToUTF8Stream(java.io.Reader appReader,
int maximumLength,
java.lang.String typeName)
appReader - application readermaximumLength - maximum allowed length in number of characters for
the readertypeName - type name of the column data is inserted into
java.lang.IllegalArgumentException - if maximum length is negative, or type
name is null| Method Detail |
|---|
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionInputStream.read()
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOException
private void fillBuffer(int startingOffset)
throws java.io.IOException
java.io.IOException
private void checkSufficientData()
throws java.io.IOException
java.io.IOException - if an errors occurs in the application stream
DerbyIOException - if Derby finds a problem with the stream;
stream is too long and cannot be truncated, or the stream length
does not match the specified lengthprivate boolean canTruncate()
private void truncate()
throws java.io.IOException
java.io.IOException
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.InputStreamjava.io.IOExceptionpublic final int available()
available in class java.io.InputStream
|
Built on Tue 2008-05-20 18:49:31-0700, from revision 658522 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||