Skip to content

Commit 7609051

Browse files
Apply spotless formatting
1 parent 60c8a23 commit 7609051

1 file changed

Lines changed: 35 additions & 34 deletions

File tree

  • sdks/java/core/src/main/java/org/apache/beam/sdk/coders

sdks/java/core/src/main/java/org/apache/beam/sdk/coders/Coder.java

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
* @param <T> the type of values being encoded and decoded
5555
*/
5656
/**
57-
* <p><b>Example usage:</b>
57+
* <b>Example usage:</b>
58+
*
5859
* <pre>{@code
5960
* Coder<String> coder = StringUtf8Coder.of();
6061
*
@@ -67,9 +68,8 @@
6768
* }
6869
* }</pre>
6970
*
70-
* <p>When multiple values are encoded into the same stream, coders must ensure
71-
* that each value can be correctly decoded. This is typically done by encoding
72-
* length or delimiter information.
71+
* <p>When multiple values are encoded into the same stream, coders must ensure that each value can
72+
* be correctly decoded. This is typically done by encoding length or delimiter information.
7373
*/
7474
public abstract class Coder<T> implements Serializable {
7575
/**
@@ -82,32 +82,32 @@ public abstract class Coder<T> implements Serializable {
8282
@Deprecated
8383
public static class Context {
8484
/**
85-
* The outer context indicates that the value being encoded or decoded
86-
* occupies the entire remaining stream.
87-
*
88-
* <p>In this context, the coder does not need to include length or boundary
89-
* information, since the value extends to the end of the stream.
90-
*
91-
* <p><b>Example:</b> Encoding a single standalone value.
92-
*/
85+
* The outer context indicates that the value being encoded or decoded occupies the entire
86+
* remaining stream.
87+
*
88+
* <p>In this context, the coder does not need to include length or boundary information, since
89+
* the value extends to the end of the stream.
90+
*
91+
* <p><b>Example:</b> Encoding a single standalone value.
92+
*/
9393
public static final Context OUTER = new Context(true);
9494
/**
95-
* The nested context indicates that the value being encoded or decoded
96-
* is part of a larger structure or stream containing multiple values.
97-
*
98-
* <p>In this context, the coder must include enough information (such as
99-
* length or delimiters) to allow correct decoding of individual elements.
100-
*
101-
* <p><b>Example:</b> Encoding elements inside a collection or record.
102-
*/
95+
* The nested context indicates that the value being encoded or decoded is part of a larger
96+
* structure or stream containing multiple values.
97+
*
98+
* <p>In this context, the coder must include enough information (such as length or delimiters)
99+
* to allow correct decoding of individual elements.
100+
*
101+
* <p><b>Example:</b> Encoding elements inside a collection or record.
102+
*/
103103
public static final Context NESTED = new Context(false);
104104

105105
/**
106-
* Indicates whether the encoded/decoded value consumes the entire remaining stream.
107-
*
108-
* <p>If true, no additional length information is required.
109-
* If false, the coder must encode boundaries to allow correct decoding.
110-
*/
106+
* Indicates whether the encoded/decoded value consumes the entire remaining stream.
107+
*
108+
* <p>If true, no additional length information is required. If false, the coder must encode
109+
* boundaries to allow correct decoding.
110+
*/
111111
public final boolean isWholeStream;
112112

113113
public Context(boolean isWholeStream) {
@@ -144,11 +144,12 @@ public String toString() {
144144
* be encoded next to each other on the output stream, each coder should encode information to
145145
* know how many bytes to read when decoding. A common approach is to prefix the encoding with the
146146
* element's encoded length.
147-
* <p>The behavior of encoding depends on the {@link Context} in which it is used.
148-
* When using {@link Context#OUTER}, the encoded value may consume the entire remaining stream,
149-
* so no additional length information is required. In contrast, when using {@link Context#NESTED},
150-
* the encoded value is part of a larger structure, and the coder must include sufficient
151-
* boundary information (such as length prefixes) to allow correct decoding of individual elements.
147+
*
148+
* <p>The behavior of encoding depends on the {@link Context} in which it is used. When using
149+
* {@link Context#OUTER}, the encoded value may consume the entire remaining stream, so no
150+
* additional length information is required. In contrast, when using {@link Context#NESTED}, the
151+
* encoded value is part of a larger structure, and the coder must include sufficient boundary
152+
* information (such as length prefixes) to allow correct decoding of individual elements.
152153
*/
153154
public abstract void encode(T value, OutputStream outStream) throws CoderException, IOException;
154155

@@ -172,10 +173,10 @@ public void encode(T value, OutputStream outStream, Context context)
172173
* how many bytes to read for each element. This is typically achieved by encoding length or
173174
* delimiter information during encoding.
174175
*
175-
* <p>The behavior of decoding depends on the {@link Context} in which it is used.
176-
* When decoding in {@link Context#OUTER}, the value is expected to consume the entire remaining
177-
* stream. In {@link Context#NESTED}, the value is part of a larger structure, so the coder must
178-
* rely on encoded boundaries (such as length prefixes) to correctly extract individual elements.
176+
* <p>The behavior of decoding depends on the {@link Context} in which it is used. When decoding
177+
* in {@link Context#OUTER}, the value is expected to consume the entire remaining stream. In
178+
* {@link Context#NESTED}, the value is part of a larger structure, so the coder must rely on
179+
* encoded boundaries (such as length prefixes) to correctly extract individual elements.
179180
*
180181
* @throws IOException if reading from the {@code InputStream} fails for some reason
181182
* @throws CoderException if the value could not be decoded for some reason

0 commit comments

Comments
 (0)