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
FieldsModifier and TypeFieldDescriptionprotected final BufferChainprotected final CharBufferprotected final CharsetEncoder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(byte alreadyEncoded) voidappend(byte[] alreadyEncoded) voidappend(byte[] alreadyEncoded, int offset, int length) voidappend(ByteBuffer alreadyEncoded) longappended()Return the number of bytes this writer will produce for the underlying layer.Returns the charset this encodes its output inwrite(boolean v) voidwrite(char[] cbuf, int offset, int len) write(double v) write(float v) voidwrite(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, writeMethods inherited from class java.io.Writer
append, append, append, close, flush, nullWriter, write, write, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
writein classGenericWriter- Throws:
IOException
-
write
- Overrides:
writein 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:
writein classWriter- Throws:
IOException
-
write
- Overrides:
writein classGenericWriter- Throws:
IOException
-
write
- Overrides:
writein classGenericWriter- Throws:
IOException
-
write
- Overrides:
writein classGenericWriter- Throws:
IOException
-
write
- Overrides:
writein classGenericWriter- Throws:
IOException
-
write
- Specified by:
writein 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
-