Class CodecUtils

java.lang.Object
ai.djl.python.engine.CodecUtils

public final class CodecUtils extends Object
This is a utility class for reading and writing to netty ByteBuf.
  • Field Details

  • Method Details

    • readBytes

      public static byte[] readBytes(io.netty.buffer.ByteBuf in, int maxLength)
      Reads the specified length of data.
      Parameters:
      in - byte buffer
      maxLength - length of the data to be read
      Returns:
      read data
    • readUtf8

      public static String readUtf8(io.netty.buffer.ByteBuf in)
      Read a String from the ByteBuf.
      Parameters:
      in - the ByteBuf.
      Returns:
      a string read from the buffer.
    • writeUtf8

      public static void writeUtf8(io.netty.buffer.ByteBuf buf, String value)
      Encode a String in UTF-8 and write it to the ByteBuf.
      Parameters:
      buf - the ByteBuf.
      value - the string to write into a buffer.