Class PrefixedStringCodec

java.lang.Object
io.datarouter.bytes.codec.stringcodec.PrefixedStringCodec

public class PrefixedStringCodec extends Object
Encodes a String as UTF-8 bytes prefixed with the number of bytes encoded as a VarInt.
  • Field Details

  • Constructor Details

    • PrefixedStringCodec

      public PrefixedStringCodec(StringCodec stringCodec)
  • Method Details

    • encode

      public byte[] encode(String value)
    • encode

      public int encode(String value, byte[] bytes, int offset)
    • decode

      public String decode(byte[] bytes)
    • decode

      public String decode(byte[] bytes, int offset)
    • decodeWithLength

      public LengthAndValue<String> decodeWithLength(byte[] bytes, int offset)