Skip to content

Commit a164ae6

Browse files
committed
add missing comments for StreamingSerializer
1 parent f5d1bb5 commit a164ae6

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

servicetalk-serializer-api/src/main/java/io/servicetalk/serializer/api/SerializerProvider.java

-19
This file was deleted.

servicetalk-serializer-api/src/main/java/io/servicetalk/serializer/api/StreamingDeserializer.java

+12
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,20 @@
2828
*/
2929
@FunctionalInterface
3030
public interface StreamingDeserializer<T> {
31+
/**
32+
* Deserialize a {@link Publisher} of {@link Buffer} into a {@link Publisher} of {@link T}.
33+
* @param serializedData the serialized stream of data represented in a {@link Publisher} of {@link Buffer}.
34+
* @param allocator the {@link BufferAllocator} to use if allocation is required.
35+
* @return The deserialized {@link Publisher} of {@link T}s.
36+
*/
3137
Publisher<T> deserialize(Publisher<Buffer> serializedData, BufferAllocator allocator);
3238

39+
/**
40+
* Deserialize a {@link Iterable} of {@link Buffer} into a {@link Iterable} of {@link T}.
41+
* @param serializedData the serialized stream data represented in a {@link Iterable} of {@link Buffer}.
42+
* @param allocator the {@link BufferAllocator} to use if allocation is required.
43+
* @return The deserialized {@link Iterable} of {@link T}s.
44+
*/
3345
default BlockingIterable<T> deserialize(Iterable<Buffer> serializedData, BufferAllocator allocator) {
3446
return deserialize(fromIterable(serializedData), allocator).toIterable();
3547
}

servicetalk-serializer-api/src/main/java/io/servicetalk/serializer/api/StreamingSerializer.java

+18
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,30 @@
2929
*/
3030
@FunctionalInterface
3131
public interface StreamingSerializer<T> {
32+
/**
33+
* Serialize a {@link Publisher} of {@link T}s into a {@link Publisher} of {@link Buffer}.
34+
* @param toSerialize the deserialized stream of data represented in a {@link Publisher} of {@link T}.
35+
* @param allocator the {@link BufferAllocator} to use if allocation is required.
36+
* @return the serialized stream of data represented in a {@link Publisher} of {@link Buffer}.
37+
*/
3238
Publisher<Buffer> serialize(Publisher<T> toSerialize, BufferAllocator allocator);
3339

40+
/**
41+
* Serialize a {@link Iterable} of {@link T}s into a {@link Iterable} of {@link Buffer}.
42+
* @param toSerialize the deserialized stream of data represented in a {@link Iterable} of {@link T}.
43+
* @param allocator the {@link BufferAllocator} to use if allocation is required.
44+
* @return the serialized stream of data represented in a {@link Iterable} of {@link Buffer}.
45+
*/
3446
default BlockingIterable<Buffer> serialize(Iterable<T> toSerialize, BufferAllocator allocator) {
3547
return serialize(fromIterable(toSerialize), allocator).toIterable();
3648
}
3749

50+
/**
51+
* Serialize a {@link PayloadWriter} of {@link T}s into a {@link PayloadWriter} of {@link Buffer}.
52+
* @param writer The {@link PayloadWriter} used to write the result of serialization to.
53+
* @param allocator the {@link BufferAllocator} to use if allocation is required.
54+
* @return a {@link PayloadWriter} where you can write {@link T}s to.
55+
*/
3856
default PayloadWriter<T> serialize(PayloadWriter<Buffer> writer, BufferAllocator allocator) {
3957
return StreamingSerializerUtils.serialize(this, writer, allocator);
4058
}

0 commit comments

Comments
 (0)