Object StringCodec

  • All Implemented Interfaces:
    eu.vstoyanov.natsy.codec.MessageCodec

    
    public class StringCodec
     implements MessageCodec<String>
                        

    Carries a String as raw UTF-8 - no quoting, no escaping, exactly the bytes a nats pub would send. Always available; String needs no registration.

    Decoding is strict. String(bytes, UTF_8) silently replaces malformed input with U+FFFD, which would let a corrupt payload past DecodeErrorStrategy and into the collector looking like text; a reporting decoder fails instead, and the strategy decides what happens next.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      ByteArray encode(String value) Encode a value for publishing.
      String decode(ByteArray data) Decode bytes received from NATS.
      String getContentType() Content type identifier for this codec
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait