Class Tag

    • Constructor Detail

      • Tag

        public Tag​(String name,
                   VINT id,
                   VINT size,
                   InputStream inputStream)
            throws IOException
        Constructor
        Parameters:
        name - - the name of tag to be created
        id - - the id of tag to be created
        size - - the size of tag to be created
        inputStream - - stream to read tag data from
        Throws:
        IOException - - in case of any IO errors
    • Method Detail

      • readData

        public void readData​(InputStream inputStream)
                      throws IOException
        method to read tag data from inputStream given
        Parameters:
        inputStream - InputStream
        Throws:
        IOException - - in case of any IO errors
      • getName

        public String getName()
        getter for name
        Returns:
        name of this Tag
      • getId

        public long getId()
        getter for id
        Returns:
        id of this Tag as binary value of correspondent VINT
      • getSize

        public long getSize()
        getter for size
        Returns:
        size of this Tag as value of correspondent VINT
      • totalSize

        public int totalSize()
        method to get total size of this tag: "header" + "contents"
        Returns:
        - total size as int
      • encode

        public byte[] encode()
                      throws IOException
        method to encode Tag as sequence of bytes
        Returns:
        - encoded Tag
        Throws:
        IOException - - in case of any IO errors