Package ipsk.io
Class VectorBuffer
- java.lang.Object
-
- ipsk.io.VectorBuffer
-
public class VectorBuffer extends java.lang.ObjectA container for byte buffer references. Stores references to dynamically allocated data buffers.- Author:
- K.Jaensch, klausj@phonetik.uni-muenchen.de
-
-
Constructor Summary
Constructors Constructor Description VectorBuffer()Create new empty container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(byte[] b)Add new buffer reference to container.java.lang.Objectclone()Get a copy of the container.byte[]get(int n)Get reference to n-th buffer in the container.java.util.VectorgetBuffers()Get reference to the buffers.longgetLength()Get total data length.voidremove(int n)Remove buffer reference at index n.intsize()Get number of stored refrences.byte[]toByteArray()Creates byte array and fills it with the data.
-
-
-
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:
clonein classjava.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
-
-