public void setLength(int length) throws IllegalStateException, IllegalArgumentException {
		if (data == null) {
			throw new IllegalStateException("Internal buffer not initialized");
		}
		if (length > data.length) {
			throw new IllegalArgumentException("Internal buffer length (" + data.length + ") is less than length argument (" + length + ")");
		}
		this.length = length;
	}