mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-20 06:59:18 +01:00
26 lines
573 B
Java
26 lines
573 B
Java
|
package de.mas.wiiu.jnus.utils;
|
||
|
|
||
|
import lombok.Getter;
|
||
|
import lombok.Setter;
|
||
|
|
||
|
public class ByteArrayBuffer {
|
||
|
@Getter public byte[] buffer;
|
||
|
@Getter @Setter int lengthOfDataInBuffer;
|
||
|
|
||
|
public ByteArrayBuffer(int length) {
|
||
|
buffer = new byte[(int) length];
|
||
|
}
|
||
|
|
||
|
public int getSpaceLeft() {
|
||
|
return buffer.length - getLengthOfDataInBuffer();
|
||
|
}
|
||
|
|
||
|
public void addLengthOfDataInBuffer(int bytesRead) {
|
||
|
lengthOfDataInBuffer += bytesRead;
|
||
|
}
|
||
|
|
||
|
public void resetLengthOfDataInBuffer() {
|
||
|
setLengthOfDataInBuffer(0);
|
||
|
}
|
||
|
}
|