Interface Codec<T>

  • Type Parameters:
    T - the type of object to serialize

    public interface Codec<T>
    Specifies a way to serialize an object to/from a data stream
    • Field Detail

      • STRING_CODEC

        static final Codec<java.lang.String> STRING_CODEC
      • COLOR_CODEC

        static final Codec<javafx.scene.paint.Color> COLOR_CODEC
    • Method Detail

      • getName

        java.lang.String getName()
      • encode

        void encode​(java.io.DataOutputStream os,
                    T t)
             throws java.io.IOException
        Throws:
        java.io.IOException
      • decode

        T decode​(java.io.DataInputStream is)
          throws java.io.IOException
        Throws:
        java.io.IOException
      • styledTextCodec

        static <S> Codec<StyledSegment<java.lang.String,​S>> styledTextCodec​(Codec<S> styleCodec)
      • listCodec

        static <T> Codec<java.util.List<T>> listCodec​(Codec<T> elemCodec)
      • collectionCodec

        static <T> Codec<java.util.Collection<T>> collectionCodec​(Codec<T> elemCodec)
      • optionalCodec

        static <T> Codec<java.util.Optional<T>> optionalCodec​(Codec<T> elemCodec)
      • enumCodec

        static <E extends java.lang.Enum<E>> Codec<E> enumCodec​(java.lang.Class<E> enumType)
      • eitherCodec

        static <L,​R> Codec<Either<L,​R>> eitherCodec​(Codec<L> lCodec,
                                                                Codec<R> rCodec)