@Beta @CanIgnoreReturnValue public interface PrimitiveSink
Sink
)Modifier and Type | Method and Description |
---|---|
PrimitiveSink |
putBoolean(boolean b)
Puts a boolean into this sink.
|
PrimitiveSink |
putByte(byte b)
Puts a byte into this sink.
|
PrimitiveSink |
putBytes(byte[] bytes)
Puts an array of bytes into this sink.
|
PrimitiveSink |
putBytes(byte[] bytes,
int off,
int len)
Puts a chunk of an array of bytes into this sink.
|
PrimitiveSink |
putBytes(ByteBuffer bytes)
Puts the remaining bytes of a byte buffer into this sink.
|
PrimitiveSink |
putChar(char c)
Puts a character into this sink.
|
PrimitiveSink |
putDouble(double d)
Puts a double into this sink.
|
PrimitiveSink |
putFloat(float f)
Puts a float into this sink.
|
PrimitiveSink |
putInt(int i)
Puts an int into this sink.
|
PrimitiveSink |
putLong(long l)
Puts a long into this sink.
|
PrimitiveSink |
putShort(short s)
Puts a short into this sink.
|
PrimitiveSink |
putString(CharSequence charSequence,
Charset charset)
Puts a string into this sink using the given charset.
|
PrimitiveSink |
putUnencodedChars(CharSequence charSequence)
Puts each 16-bit code unit from the
CharSequence into this sink. |
PrimitiveSink putByte(byte b)
b
- a bytePrimitiveSink putBytes(byte[] bytes)
bytes
- a byte arrayPrimitiveSink putBytes(byte[] bytes, int off, int len)
bytes[off]
is the first byte written,
bytes[off + len - 1]
is the last.bytes
- a byte arrayoff
- the start offset in the arraylen
- the number of bytes to writeIndexOutOfBoundsException
- if off < 0
or off + len > bytes.length
or
len < 0
PrimitiveSink putBytes(ByteBuffer bytes)
bytes.position()
is the first
byte written, bytes.limit() - 1
is the last. The position of the buffer will be equal
to the limit when this method returns.bytes
- a byte bufferPrimitiveSink putShort(short s)
PrimitiveSink putInt(int i)
PrimitiveSink putLong(long l)
PrimitiveSink putFloat(float f)
PrimitiveSink putDouble(double d)
PrimitiveSink putBoolean(boolean b)
PrimitiveSink putChar(char c)
PrimitiveSink putUnencodedChars(CharSequence charSequence)
CharSequence
into this sink.
Warning: This method will produce different output than most other languages do when
running on the equivalent input. For cross-language compatibility, use putString(java.lang.CharSequence, java.nio.charset.Charset)
,
usually with a charset of UTF-8. For other use cases, use putUnencodedChars
.
PrimitiveSink putString(CharSequence charSequence, Charset charset)
Warning: This method, which reencodes the input before processing it, is useful only
for cross-language compatibility. For other use cases, prefer putUnencodedChars(java.lang.CharSequence)
, which
is faster, produces the same output across Java releases, and processes every char
in
the input, even if some are invalid.
Copyright © 2010–2017. All rights reserved.