Package ipsk.io

Class VectorBuffer


  • public class VectorBuffer
    extends java.lang.Object
    A container for byte buffer references. Stores references to dynamically allocated data buffers.
    Author:
    K.Jaensch, klausj@phonetik.uni-muenchen.de
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Vector<byte[]> buffers
      contains the buffer references.
      protected long length
      total stored (referenced) data length
    • Constructor Summary

      Constructors 
      Constructor Description
      VectorBuffer()
      Create new empty container.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(byte[] b)
      Add new buffer reference to container.
      java.lang.Object clone()
      Get a copy of the container.
      byte[] get​(int n)
      Get reference to n-th buffer in the container.
      java.util.Vector getBuffers()
      Get reference to the buffers.
      long getLength()
      Get total data length.
      void remove​(int n)
      Remove buffer reference at index n.
      int size()
      Get number of stored refrences.
      byte[] toByteArray()
      Creates byte array and fills it with the data.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • length

        protected long length
        total stored (referenced) data length
      • buffers

        protected java.util.Vector<byte[]> buffers
        contains the buffer references.
    • Constructor Detail

      • VectorBuffer

        public VectorBuffer()
        Create new empty container.
    • Method Detail

      • get

        public byte[] get​(int n)
        Get reference to n-th buffer in the container.
        Parameters:
        n -
        Returns:
        n-th byte buffer
      • size

        public int size()
        Get number of stored refrences. NOTE: This is not the total size of data.
        Returns:
        number of stored refrences
      • add

        public void add​(byte[] b)
        Add new buffer reference to container.
        Parameters:
        b - the new buffer
      • remove

        public void remove​(int n)
        Remove buffer reference at index n.
        Parameters:
        n - index
      • clone

        public java.lang.Object clone()
        Get a copy of the container. Does not deep copy the data buffers !
        Overrides:
        clone in class java.lang.Object
        Returns:
        clone of the container
      • getLength

        public long getLength()
        Get total data length. The summary of the data length of each referenced buffer.
        Returns:
        data length
      • getBuffers

        public java.util.Vector getBuffers()
        Get reference to the buffers. Returns NO copy of the container.
        Returns:
        reference to container
        See Also:
        clone()
      • toByteArray

        public byte[] toByteArray()
        Creates byte array and fills it with the data.
        Returns:
        contents of buffer as byte array