Package io.servicetalk.encoding.api
Interface ContentCodec
-
public interface ContentCodec
API to support encode and decode ofBuffer
s.Implementations must provide thread safety semantics, since instances could be shared across threads.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Buffer
decode(Buffer src, int offset, int length, BufferAllocator allocator)
default Buffer
decode(Buffer src, BufferAllocator allocator)
Publisher<Buffer>
decode(Publisher<Buffer> from, BufferAllocator allocator)
Buffer
encode(Buffer src, int offset, int length, BufferAllocator allocator)
default Buffer
encode(Buffer src, BufferAllocator allocator)
Publisher<Buffer>
encode(Publisher<Buffer> from, BufferAllocator allocator)
java.lang.CharSequence
name()
A unique textual representation for the coding.
-
-
-
Method Detail
-
name
java.lang.CharSequence name()
A unique textual representation for the coding.- Returns:
- a unique textual representation for the coding.
-
encode
default Buffer encode(Buffer src, BufferAllocator allocator)
Take aBuffer
and encode its contents resulting in aBuffer
with the encoded contents. This call increases thereaderIndex
of thesrc
with the number of bytes available to readsrc.readableBytes()
.- Parameters:
src
- theBuffer
to encodeallocator
- theBufferAllocator
to use for allocating auxiliary buffers or the returned buffer- Returns:
Buffer
the result buffer with the content encoded
-
encode
Buffer encode(Buffer src, int offset, int length, BufferAllocator allocator)
Take aBuffer
and encode its contents resulting in aBuffer
with the encoded contents. This call increases thereaderIndex
of thesrc
with the number of bytes readlength
.- Parameters:
src
- theBuffer
to encodeoffset
- the offset after the currentBuffer
'sreaderInde
to start reading fromlength
- the total count of bytes to readallocator
- theBufferAllocator
to use for allocating auxiliary buffers or the returned buffer- Returns:
Buffer
the result buffer with the content encoded
-
decode
default Buffer decode(Buffer src, BufferAllocator allocator)
Take aBuffer
and decode its contents resulting in aBuffer
with the decoded content. This call increases thereaderIndex
of thesrc
with the number of bytes available to readsrc.readableBytes()
.- Parameters:
src
- theBuffer
to decodeallocator
- theBufferAllocator
to use for allocating auxiliary buffers or the returned buffer- Returns:
Buffer
the result buffer with the content decoded
-
decode
Buffer decode(Buffer src, int offset, int length, BufferAllocator allocator)
Take aBuffer
and decode its contents resulting in aBuffer
with the decoded content. This call increases thereaderIndex
of thesrc
with the number of bytes readlength
.- Parameters:
src
- theBuffer
to decodeoffset
- the offset after the currentBuffer
'sreaderIndex
to start reading fromlength
- the total count of bytes to readallocator
- theBufferAllocator
to use for allocating auxiliary buffers or the returned buffer- Returns:
Buffer
the result buffer with the content decoded
-
encode
Publisher<Buffer> encode(Publisher<Buffer> from, BufferAllocator allocator)
Take aPublisher
ofBuffer
and encode its contents resulting in aPublisher
ofBuffer
with the encoded contents.- Parameters:
from
- thePublisher
buffer to encodeallocator
- theBufferAllocator
to use for allocating auxiliary buffers or the returned buffer- Returns:
Publisher
the result publisher with the buffers encoded
-
decode
Publisher<Buffer> decode(Publisher<Buffer> from, BufferAllocator allocator)
Take aPublisher
ofBuffer
and encode its contents resulting in aPublisher
ofBuffer
with the decoded contents.- Parameters:
from
- thePublisher
to decodedallocator
- theBufferAllocator
to use for allocating auxiliary buffers or the returned buffer- Returns:
Publisher
the result publisher with the buffers decoded
-
-