litesoft
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package org.litesoft.codec;
import org.litesoft.core.annotations.*;
import org.litesoft.core.util.*;
/**
* Implementations of this Codec must produce and consume self-terminating encodings.
* <p/>
* A self-terminating encoded value, when decoding, will only consume as many characters
* from the CharSource as were generated by the encode method.
*/
public interface Codec<T>
{
/**
* Encode the Value into a self-terminating non-Null String.
*/
@NotNull String encode( @Nullable T pValue );
/**
* Decode the Value as a self-terminating non-Null String (generated by the encode method).
* <p/>
* Note: No extraneous characters allowed on the parameter Value.
*/
@Nullable T decode( @NotNull String pValue );
/**
* Decode the next self-terminating character stream from the CharSource.
*/
@Nullable T decode( @NotNull CharSource pCharSource );
}
|