Code example for BufferUnderflowException

0
 
	@Override 
	public byte get() throws BufferUnderflowException {
		/* fetch address: [bufIndex, offset] */ 
		if (bufIndex >= buffers.size())
			throw new BufferUnderflowException();
		byte[] buf = buffers.get(bufIndex);
 
		if (bufOffset >= buf.length) {
			bufOffset = 0;
			bufIndex += 1;
			if (bufIndex >= buffers.size())
				throw new BufferUnderflowException();
			buf = buffers.get(bufIndex);
		} 
 
		byte retVal = buf[bufOffset];
 
		/* modify offset */ 
		if ((bufOffset + 1) >= buf.length) {
Experience pair programming with AI  Get Codota for Java