Package com.yahoo.io
Class AbstractByteWriter
java.lang.Object
java.io.Writer
com.yahoo.text.GenericWriter
com.yahoo.io.AbstractByteWriter
- All Implemented Interfaces:
WritableByteTransmitter
,Closeable
,Flushable
,Appendable
,AutoCloseable
- Direct Known Subclasses:
ByteWriter
,Utf8ByteWriter
Base class for writers needing to accept binary data.
- Author:
- Steinar Knutsen, baldersheim
-
Field Summary
Modifier and TypeFieldDescriptionprotected final BufferChain
protected final CharBuffer
protected final CharsetEncoder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(byte alreadyEncoded) void
append
(byte[] alreadyEncoded) void
append
(byte[] alreadyEncoded, int offset, int length) void
append
(ByteBuffer alreadyEncoded) long
appended()
Return the number of bytes this writer will produce for the underlying layer.Returns the charset this encodes its output inwrite
(boolean v) void
write
(char[] cbuf, int offset, int len) write
(double v) write
(float v) void
write
(int v) Do note, if writing the first character of a surrogate pair, the next character written must be the second part of the pair.write
(long v) write
(short v) Methods inherited from class com.yahoo.text.GenericWriter
write, write, write
Methods inherited from class java.io.Writer
append, append, append, close, flush, nullWriter, write, write, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.yahoo.io.WritableByteTransmitter
send
-
Field Details
-
encoder
-
buffer
-
charBuffer
-
-
Constructor Details
-
AbstractByteWriter
-
-
Method Details
-
getEncoding
Returns the charset this encodes its output in -
write
- Overrides:
write
in classGenericWriter
- Throws:
IOException
-
write
- Overrides:
write
in classGenericWriter
- Throws:
IOException
-
write
Do note, if writing the first character of a surrogate pair, the next character written must be the second part of the pair. If this is not the case, the surrogate will be omitted from output.- Overrides:
write
in classWriter
- Throws:
IOException
-
write
- Overrides:
write
in classGenericWriter
- Throws:
IOException
-
write
- Overrides:
write
in classGenericWriter
- Throws:
IOException
-
write
- Overrides:
write
in classGenericWriter
- Throws:
IOException
-
write
- Overrides:
write
in classGenericWriter
- Throws:
IOException
-
write
- Specified by:
write
in classWriter
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-
appended
public long appended()Return the number of bytes this writer will produce for the underlying layer. That is, it sums the length of the raw bytes received and the number of bytes in the written strings after encoding.- Returns:
- the number of bytes appended to this writer
-