Javolution 6.0.0 java
|
Public Member Functions | |
UTF8ByteBufferWriter () | |
UTF8ByteBufferWriter | setOutput (ByteBuffer byteBuffer) |
void | write (char c) throws IOException |
void | write (int code) throws IOException |
void | write (char cbuf[], int off, int len) throws IOException |
void | write (String str, int off, int len) throws IOException |
void | write (CharSequence csq) throws IOException |
void | flush () throws IOException |
void | close () throws IOException |
void | reset () |
UTF8ByteBufferWriter | setByteBuffer (ByteBuffer byteBuffer) |
Private Member Functions | |
void | write2 (int c) throws IOException |
Private Attributes | |
ByteBuffer | _byteBuffer |
char | _highSurrogate |
A UTF-8 java.nio.ByteBuffer
writer.
This writer supports surrogate char
pairs (representing characters in the range [U+10000 .. U+10FFFF]). It can also be used to write characters from their unicodes (31 bits) directly (ref. write(int)).
Instances of this class can be reused for different output streams and can be part of a higher level component (e.g. serializer) in order to avoid dynamic buffer allocation when the destination output changes. Also wrapping using a java.io.BufferedWriter
is unnescessary as instances of this class embed their own data buffers.
Note: This writer is unsynchronized and always produces well-formed UTF-8 sequences.
Definition at line 37 of file UTF8ByteBufferWriter.java.
javolution.io.UTF8ByteBufferWriter.UTF8ByteBufferWriter | ( | ) |
void javolution.io.UTF8ByteBufferWriter.close | ( | ) | throws IOException |
Closes and resets this writer for reuse.
IOException | if an I/O error occurs |
Definition at line 205 of file UTF8ByteBufferWriter.java.
References javolution.io.UTF8ByteBufferWriter._byteBuffer, and javolution.io.UTF8ByteBufferWriter.reset().
void javolution.io.UTF8ByteBufferWriter.flush | ( | ) | throws IOException |
Flushes the stream (this method has no effect, the data is always directly written to the ByteBuffer
).
IOException | if an I/O error occurs. |
Definition at line 196 of file UTF8ByteBufferWriter.java.
References javolution.io.UTF8ByteBufferWriter._byteBuffer.
void javolution.io.UTF8ByteBufferWriter.reset | ( | ) |
Definition at line 212 of file UTF8ByteBufferWriter.java.
References javolution.io.UTF8ByteBufferWriter._byteBuffer, and javolution.io.UTF8ByteBufferWriter._highSurrogate.
Referenced by javolution.io.UTF8ByteBufferWriter.close(), and javolution.io.Struct.UTF8String.set().
UTF8ByteBufferWriter javolution.io.UTF8ByteBufferWriter.setByteBuffer | ( | ByteBuffer | byteBuffer | ) |
Definition at line 220 of file UTF8ByteBufferWriter.java.
References javolution.io.UTF8ByteBufferWriter.setOutput().
UTF8ByteBufferWriter javolution.io.UTF8ByteBufferWriter.setOutput | ( | ByteBuffer | byteBuffer | ) |
Sets the byte buffer to use for writing until this writer is closed.
byteBuffer | the destination byte buffer. |
Definition at line 57 of file UTF8ByteBufferWriter.java.
References javolution.io.UTF8ByteBufferWriter._byteBuffer.
Referenced by javolution.io.Struct.UTF8String.set(), and javolution.io.UTF8ByteBufferWriter.setByteBuffer().
void javolution.io.UTF8ByteBufferWriter.write | ( | char | c | ) | throws IOException |
Writes a single character. This method supports 16-bits character surrogates.
c | char the character to be written (possibly a surrogate). |
IOException | if an I/O error occurs. |
Definition at line 72 of file UTF8ByteBufferWriter.java.
References javolution.io.UTF8ByteBufferWriter._highSurrogate.
Referenced by javolution.io.Struct.UTF8String.set(), and javolution.io.UTF8ByteBufferWriter.write().
void javolution.io.UTF8ByteBufferWriter.write | ( | char | cbuf[], |
int | off, | ||
int | len | ||
) | throws IOException |
Writes a portion of an array of characters.
cbuf | the array of characters. |
off | the offset from which to start writing characters. |
len | the number of characters to write. |
IOException | if an I/O error occurs. |
Definition at line 140 of file UTF8ByteBufferWriter.java.
References javolution.io.UTF8ByteBufferWriter._byteBuffer, and javolution.io.UTF8ByteBufferWriter.write().
void javolution.io.UTF8ByteBufferWriter.write | ( | CharSequence | csq | ) | throws IOException |
Writes the specified character sequence.
csq | the character sequence. |
IOException | if an I/O error occurs |
Definition at line 178 of file UTF8ByteBufferWriter.java.
References javolution.io.UTF8ByteBufferWriter._byteBuffer, and javolution.io.UTF8ByteBufferWriter.write().
void javolution.io.UTF8ByteBufferWriter.write | ( | int | code | ) | throws IOException |
Writes a character given its 31-bits Unicode.
code | the 31 bits Unicode of the character to be written. |
IOException | if an I/O error occurs. |
Definition at line 92 of file UTF8ByteBufferWriter.java.
References javolution.io.UTF8ByteBufferWriter._byteBuffer, and javolution.io.UTF8ByteBufferWriter.write2().
void javolution.io.UTF8ByteBufferWriter.write | ( | String | str, |
int | off, | ||
int | len | ||
) | throws IOException |
Writes a portion of a string.
str | a String. |
off | the offset from which to start writing characters. |
len | the number of characters to write. |
IOException | if an I/O error occurs |
Definition at line 160 of file UTF8ByteBufferWriter.java.
References javolution.io.UTF8ByteBufferWriter._byteBuffer, and javolution.io.UTF8ByteBufferWriter.write().
|
private |
Definition at line 100 of file UTF8ByteBufferWriter.java.
References javolution.io.UTF8ByteBufferWriter._byteBuffer.
Referenced by javolution.io.UTF8ByteBufferWriter.write().
|
private |
Holds the byte buffer destination.
Definition at line 42 of file UTF8ByteBufferWriter.java.
Referenced by javolution.io.UTF8ByteBufferWriter.close(), javolution.io.UTF8ByteBufferWriter.flush(), javolution.io.UTF8ByteBufferWriter.reset(), javolution.io.UTF8ByteBufferWriter.setOutput(), javolution.io.UTF8ByteBufferWriter.write(), and javolution.io.UTF8ByteBufferWriter.write2().
|
private |
Definition at line 84 of file UTF8ByteBufferWriter.java.
Referenced by javolution.io.UTF8ByteBufferWriter.reset(), and javolution.io.UTF8ByteBufferWriter.write().