| Constructor and Description |
|---|
BufferedEncoder(int size,
com.google.common.base.Function<OutputStream,Encoder> encoderFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
reset() |
int |
size() |
Encoder |
writeBool(boolean b) |
Encoder |
writeBytes(byte[] bytes) |
Encoder |
writeBytes(byte[] bytes,
int off,
int len) |
Encoder |
writeBytes(ByteBuffer bytes)
Writes out the remaining bytes in
ByteBuffer. |
Encoder |
writeDouble(double d) |
Encoder |
writeFloat(float f) |
Encoder |
writeInt(int i) |
Encoder |
writeLong(long l) |
Encoder |
writeNull() |
Encoder |
writeRaw(byte[] rawBytes)
Writes raw bytes to the buffer without encoding.
|
Encoder |
writeRaw(byte[] rawBytes,
int off,
int len)
Writes raw bytes to the buffer without encoding.
|
Encoder |
writeString(String s) |
void |
writeTo(OutputStream out)
Writes all the buffered bytes into the given OutputStream.
|
public BufferedEncoder(int size,
com.google.common.base.Function<OutputStream,Encoder> encoderFactory)
public void reset()
public void writeTo(OutputStream out) throws IOException
out - The output stream to write to.IOExceptionpublic int size()
public Encoder writeRaw(byte[] rawBytes) throws IOException
writeRaw(rawBytes, 0, rawBytes.length).IOExceptionpublic Encoder writeRaw(byte[] rawBytes, int off, int len) throws IOException
rawBytes - The bytes to write.off - Offset to start in the byte array.len - Number of bytes to write starting from the offset.IOExceptionpublic Encoder writeNull() throws IOException
writeNull in interface EncoderIOExceptionpublic Encoder writeBool(boolean b) throws IOException
writeBool in interface EncoderIOExceptionpublic Encoder writeInt(int i) throws IOException
writeInt in interface EncoderIOExceptionpublic Encoder writeLong(long l) throws IOException
writeLong in interface EncoderIOExceptionpublic Encoder writeFloat(float f) throws IOException
writeFloat in interface EncoderIOExceptionpublic Encoder writeDouble(double d) throws IOException
writeDouble in interface EncoderIOExceptionpublic Encoder writeString(String s) throws IOException
writeString in interface EncoderIOExceptionpublic Encoder writeBytes(byte[] bytes) throws IOException
writeBytes in interface EncoderIOExceptionpublic Encoder writeBytes(byte[] bytes, int off, int len) throws IOException
writeBytes in interface EncoderIOExceptionpublic Encoder writeBytes(ByteBuffer bytes) throws IOException
EncoderByteBuffer.
The given ByteBuffer is untounch after this method is returned (i.e. same position and limit).writeBytes in interface Encoderbytes - bytes to writeIOExceptionCopyright © 2019 CDAP Licensed under the Apache License, Version 2.0.