Class Field

  • Direct Known Subclasses:
    BinaryField, NumberField, StringField

    public abstract class Field
    extends Object
    All dbserver messages are made up of lists of fields, which are type-tagged values.
    James Elliott
    • Constructor Detail

      • Field

        public Field()
    • Method Detail

      • getBytes

        public abstract ByteBuffer getBytes()
        Get the bytes which represent this field when sent over the network, including the leading type tag.
        a freshly rewound buffer containing the full set of bytes which should be transmitted for this field.
      • getSize

        public abstract long getSize()
        Get the size, in bytes, of the network representation of this field, excluding the leading type tag and length bytes (if any).
        the number of bytes which will be written after the type tag (and length indicator, if present) when sending this field.
      • getTypeTag

        public abstract byte getTypeTag()
        Get the value which identifies the start of this field in the network stream.
        the tag which tells the recipient that this particular type of field is coming.
      • getArgumentTag

        public abstract byte getArgumentTag()
        Get the value which identifies this type of field in a message argument list.
        the tag which is used instead of the type tag for some reason when putting together the argument type list for a dbserver message.
      • read

        public static Field read​(DataInputStream is)
                          throws IOException
        Read a field from the supplied stream, starting with the tag that identifies the type, and reading enough to collect the corresponding value.
        is - the stream on which a type tag is expected to be the next byte, followed by the field value.
        the field that was found on the stream.
        IOException - if there is a problem reading the field.
      • write

        public void write​(WritableByteChannel channel)
                   throws IOException
        Write the field to the specified channel.
        channel - the channel to which it should be written
        IOException - if there is a problem writing to the channel