Package io.servicetalk.encoding.api
Interface ContentCodec
-
public interface ContentCodecAPI to support encode and decode ofBuffers.Implementations must provide thread safety semantics, since instances could be shared across threads.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Bufferdecode(Buffer src, int offset, int length, BufferAllocator allocator)Deprecated.Use the plaindecode(Buffer, BufferAllocator)version andBuffer.slice(int, int)where needed.Bufferdecode(Buffer src, BufferAllocator allocator)Publisher<Buffer>decode(Publisher<Buffer> from, BufferAllocator allocator)Bufferencode(Buffer src, int offset, int length, BufferAllocator allocator)Deprecated.Use the plainencode(Buffer, BufferAllocator)version andBuffer.slice(int, int)where needed.Bufferencode(Buffer src, BufferAllocator allocator)Publisher<Buffer>encode(Publisher<Buffer> from, BufferAllocator allocator)java.lang.CharSequencename()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
Buffer encode(Buffer src, BufferAllocator allocator)
Take aBufferand encode its contents resulting in aBufferwith the encoded contents. This call increases theBuffer.readerIndex()of thesrcwith the number of bytes available to readBuffer.readableBytes().- Parameters:
src- theBufferto encodeallocator- theBufferAllocatorto use for allocating auxiliary buffers or the returned buffer- Returns:
Bufferthe result buffer with the content encoded
-
encode
@Deprecated Buffer encode(Buffer src, int offset, int length, BufferAllocator allocator)
Deprecated.Use the plainencode(Buffer, BufferAllocator)version andBuffer.slice(int, int)where needed.Take aBufferand encode its contents resulting in aBufferwith the encoded contents. This call increases theBuffer.readerIndex()of thesrcwith the number of bytes readlength.- Parameters:
src- theBufferto encodeoffset- the offset after the currentBuffer.readerIndex()to start reading fromlength- the total count of bytes to readallocator- theBufferAllocatorto use for allocating auxiliary buffers or the returned buffer- Returns:
Bufferthe result buffer with the content encoded
-
decode
Buffer decode(Buffer src, BufferAllocator allocator)
Take aBufferand decode its contents resulting in aBufferwith the decoded content. This call increases the {Buffer.readerIndex()of thesrcwith the number of bytes available to readBuffer.readableBytes().- Parameters:
src- theBufferto decodeallocator- theBufferAllocatorto use for allocating auxiliary buffers or the returned buffer- Returns:
Bufferthe result buffer with the content decoded
-
decode
@Deprecated Buffer decode(Buffer src, int offset, int length, BufferAllocator allocator)
Deprecated.Use the plaindecode(Buffer, BufferAllocator)version andBuffer.slice(int, int)where needed.Take aBufferand decode its contents resulting in aBufferwith the decoded content. This call increases theBuffer.readerIndex()of thesrcwith the number of bytes readlength.- Parameters:
src- theBufferto decodeoffset- the offset after the currentBuffer.readerIndex()to start reading fromlength- the total count of bytes to readallocator- theBufferAllocatorto use for allocating auxiliary buffers or the returned buffer- Returns:
Bufferthe result buffer with the content decoded
-
encode
Publisher<Buffer> encode(Publisher<Buffer> from, BufferAllocator allocator)
Take aPublisherofBufferand encode its contents resulting in aPublisherofBufferwith the encoded contents.- Parameters:
from- thePublisherbuffer to encodeallocator- theBufferAllocatorto use for allocating auxiliary buffers or the returned buffer- Returns:
Publisherthe result publisher with the buffers encoded
-
decode
Publisher<Buffer> decode(Publisher<Buffer> from, BufferAllocator allocator)
Take aPublisherofBufferand encode its contents resulting in aPublisherofBufferwith the decoded contents.- Parameters:
from- thePublisherto decodedallocator- theBufferAllocatorto use for allocating auxiliary buffers or the returned buffer- Returns:
Publisherthe result publisher with the buffers decoded
-
-