JNUSLib/src/de/mas/wiiu/jnus/utils/ByteArrayBuffer.java

26 lines
573 B
Java
Raw Normal View History

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);
}
}