Class StringField

  • public class StringField
    extends Field
    A string field holds a UTF8-BE encoded string whose length is determined by the 4-byte big-endian integer that follows the type tag.
    James Elliott
    • Constructor Detail

      • StringField

        public StringField​(DataInputStream is)
                    throws IOException
        Constructor for reading from the network.
        is - the stream on which the field value is to be read.
        IOException - if there is a problem reading the value.
      • StringField

        public StringField​(String text)
        Constructor for code.
        text - the value that this field will convey.
    • Method Detail

      • getValue

        public String getValue()
        Get the string represented by this field.
        the text that this field contains.
      • getTypeTag

        public byte getTypeTag()
        Description copied from class: Field
        Get the value which identifies the start of this field in the network stream.
        Specified by:
        getTypeTag in class Field
        the tag which tells the recipient that this particular type of field is coming.
      • getArgumentTag

        public byte getArgumentTag()
        Description copied from class: Field
        Get the value which identifies this type of field in a message argument list.
        Specified by:
        getArgumentTag in class Field
        the tag which is used instead of the type tag for some reason when putting together the argument type list for a dbserver message.
      • getBytes

        public ByteBuffer getBytes()
        Description copied from class: Field
        Get the bytes which represent this field when sent over the network, including the leading type tag.
        Specified by:
        getBytes in class Field
        a freshly rewound buffer containing the full set of bytes which should be transmitted for this field.
      • getSize

        public long getSize()
        Description copied from class: Field
        Get the size, in bytes, of the network representation of this field, excluding the leading type tag and length bytes (if any).
        Specified by:
        getSize in class Field
        the number of bytes which will be written after the type tag (and length indicator, if present) when sending this field.