Class Proto

java.lang.Object
ai.beestream.jitnn.onnx.Proto

public final class Proto extends Object
A reader for the protocol buffers wire format, enough to decode ONNX's messages without a protobuf library: varints, fixed 32/64-bit values and length-delimited fields (strings, bytes, nested messages and packed repeated numbers). Public for jitNN's other importers (TensorFlow); not a stable API.
  • Constructor Details

    • Proto

      public Proto(ByteBuffer buf)
      A reader over the message in buf, from its position to its limit.
  • Method Details

    • next

      public boolean next()
      Advances to the next field; false at the end of the message.
    • field

      public int field()
      The field number of the current field.
    • wire

      public int wire()
      The wire type of the current field (0 varint, 1 fixed64, 2 length-delimited, 5 fixed32).
    • varint

      public long varint()
      Reads a varint.
    • fixed64

      public long fixed64()
      Reads a little-endian 64-bit value.
    • fixed32

      public int fixed32()
      Reads a little-endian 32-bit value.
    • float32

      public float float32()
      Reads a 32-bit float.
    • float64

      public double float64()
      Reads a 64-bit float.
    • bytes

      public ByteBuffer bytes()
      The current length-delimited field as a view (no copy).
    • string

      public String string()
      The current length-delimited field as a UTF-8 string.
    • message

      public Proto message()
      The current length-delimited field as a nested message.
    • longs

      public void longs(Proto.LongSink sink)
      Repeated int64 values: one varint, or a packed run.
    • floats

      public void floats(Proto.FloatSink sink)
      Repeated float values: one fixed32, or a packed run.
    • doubles

      public void doubles(Proto.DoubleSink sink)
      Repeated double values: one fixed64, or a packed run.
    • skip

      public void skip()
      Skips the current field's value.