| Modifier and Type | Method and Description |
|---|---|
Buffer |
buffer()
Returns this sink's internal buffer.
|
BufferedSink |
emit()
Writes all buffered data to the underlying sink, if one exists.
|
BufferedSink |
emitCompleteSegments()
Writes complete segments to the underlying sink, if one exists.
|
OutputStream |
outputStream()
Returns an output stream that writes to this sink.
|
BufferedSink |
write(byte[] source)
Like
OutputStream.write(byte[]), this writes a complete byte array to
this sink. |
BufferedSink |
write(byte[] source,
int offset,
int byteCount)
Like
OutputStream.write(byte[], int, int), this writes byteCount
bytes of source, starting at offset. |
BufferedSink |
write(ByteString byteString) |
BufferedSink |
write(Source source,
long byteCount)
Removes
byteCount bytes from source and appends them to this sink. |
long |
writeAll(Source source)
Removes all bytes from
source and appends them to this sink. |
BufferedSink |
writeByte(int b)
Writes a byte to this sink.
|
BufferedSink |
writeDecimalLong(long v)
Writes a long to this sink in signed decimal form (i.e., as a string in base 10).
|
BufferedSink |
writeHexadecimalUnsignedLong(long v)
Writes a long to this sink in hexadecimal form (i.e., as a string in base 16).
|
BufferedSink |
writeInt(int i)
Writes a big-endian int to this sink using four bytes.
|
BufferedSink |
writeIntLe(int i)
Writes a little-endian int to this sink using four bytes.
|
BufferedSink |
writeLong(long v)
Writes a big-endian long to this sink using eight bytes.
|
BufferedSink |
writeLongLe(long v)
Writes a little-endian long to this sink using eight bytes.
|
BufferedSink |
writeShort(int s)
Writes a big-endian short to this sink using two bytes.
|
BufferedSink |
writeShortLe(int s)
Writes a little-endian short to this sink using two bytes.
|
BufferedSink |
writeString(String string,
Charset charset)
Encodes
string in charset and writes it to this sink. |
BufferedSink |
writeString(String string,
int beginIndex,
int endIndex,
Charset charset)
Encodes the characters at
beginIndex up to endIndex from string in
charset and writes it to this sink. |
BufferedSink |
writeUtf8(String string)
Encodes
string in UTF-8 and writes it to this sink. |
BufferedSink |
writeUtf8(String string,
int beginIndex,
int endIndex)
Encodes the characters at
beginIndex up to endIndex from string in
UTF-8 and writes it to this sink. |
BufferedSink |
writeUtf8CodePoint(int codePoint)
Encodes
codePoint in UTF-8 and writes it to this sink. |
Buffer buffer()
BufferedSink write(ByteString byteString) throws IOException
IOExceptionBufferedSink write(byte[] source) throws IOException
OutputStream.write(byte[]), this writes a complete byte array to
this sink.IOExceptionBufferedSink write(byte[] source, int offset, int byteCount) throws IOException
OutputStream.write(byte[], int, int), this writes byteCount
bytes of source, starting at offset.IOExceptionlong writeAll(Source source) throws IOException
source and appends them to this sink. Returns the
number of bytes read which will be 0 if source is exhausted.IOExceptionBufferedSink write(Source source, long byteCount) throws IOException
byteCount bytes from source and appends them to this sink.IOExceptionBufferedSink writeUtf8(String string) throws IOException
string in UTF-8 and writes it to this sink.IOExceptionBufferedSink writeUtf8(String string, int beginIndex, int endIndex) throws IOException
beginIndex up to endIndex from string in
UTF-8 and writes it to this sink.IOExceptionBufferedSink writeUtf8CodePoint(int codePoint) throws IOException
codePoint in UTF-8 and writes it to this sink.IOExceptionBufferedSink writeString(String string, Charset charset) throws IOException
string in charset and writes it to this sink.IOExceptionBufferedSink writeString(String string, int beginIndex, int endIndex, Charset charset) throws IOException
beginIndex up to endIndex from string in
charset and writes it to this sink.IOExceptionBufferedSink writeByte(int b) throws IOException
IOExceptionBufferedSink writeShort(int s) throws IOException
IOExceptionBufferedSink writeShortLe(int s) throws IOException
IOExceptionBufferedSink writeInt(int i) throws IOException
IOExceptionBufferedSink writeIntLe(int i) throws IOException
IOExceptionBufferedSink writeLong(long v) throws IOException
IOExceptionBufferedSink writeLongLe(long v) throws IOException
IOExceptionBufferedSink writeDecimalLong(long v) throws IOException
IOExceptionBufferedSink writeHexadecimalUnsignedLong(long v) throws IOException
IOExceptionBufferedSink emitCompleteSegments() throws IOException
Sink.flush(), but
weaker. Use this to limit the memory held in the buffer to a single segment.IOExceptionBufferedSink emit() throws IOException
Sink.flush(), but
weaker. Call this before this buffered sink goes out of scope so that its data can reach its
destination.IOExceptionOutputStream outputStream()
Copyright © 2015. All Rights Reserved.