Package org.deepjava.runtime.util
Class ByteLiFo
- java.lang.Object
-
- org.deepjava.runtime.util.ByteLiFo
-
public class ByteLiFo extends Object
Non thread-save last in first outbytequeue.
-
-
Constructor Summary
Constructors Constructor Description ByteLiFo(int size)Creates a newByteLifowithsizeentries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailToRead()Reads the available entries in the queue.voidclear()Clears the LiFo.booleancompare(byte[] cData, int lifoOffset, int length)Compares the LiFo with abyte array.bytepop()Removes onebytefrom the LiFo.voidpush(byte d)Inserts onebyteinto the LiFo.
-
-
-
Method Detail
-
push
public void push(byte d)
Inserts onebyteinto the LiFo.- Parameters:
d-Bytewhich will be inserted into the LiFo
-
pop
public byte pop()
Removes onebytefrom the LiFo.- Returns:
- The removed byte
-
clear
public void clear()
Clears the LiFo.
-
availToRead
public int availToRead()
Reads the available entries in the queue.- Returns:
- The available
bytesto read.
-
compare
public boolean compare(byte[] cData, int lifoOffset, int length)Compares the LiFo with abyte array.- Parameters:
cData- The byte array to compare with the LiFolifoOffset- The start offset of the LiFolength- The length ofcData- Returns:
- true if
cDataand the LiFo are equal, false otherwise
-
-