Package org.apache.datasketches.memory
Interface BaseBuffer
-
- All Superinterfaces:
BaseState
- All Known Subinterfaces:
Buffer
,WritableBuffer
public interface BaseBuffer extends BaseState
Defines the relative positional API.- Author:
- Lee Rhodes
-
-
Field Summary
-
Fields inherited from interface org.apache.datasketches.memory.BaseState
defaultMemReqSvr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getEnd()
Gets the end positionlong
getPosition()
Gets the current positionlong
getRemaining()
The number of elements remaining between the current position and the end positionlong
getStart()
Gets start positionboolean
hasRemaining()
Returns true if there are elements remaining between the current position and the end positionBaseBuffer
incrementAndCheckPosition(long increment)
Increments the current position by the given increment.BaseBuffer
incrementPosition(long increment)
Increments the current position by the given increment.BaseBuffer
resetPosition()
Resets the current position to the start position, This does not modify any data.BaseBuffer
setAndCheckPosition(long position)
Sets the current position.BaseBuffer
setAndCheckStartPositionEnd(long start, long position, long end)
Sets start position, current position, and end position.BaseBuffer
setPosition(long position)
Sets the current position.BaseBuffer
setStartPositionEnd(long start, long position, long end)
Sets start position, current position, and end position.-
Methods inherited from interface org.apache.datasketches.memory.BaseState
checkValidAndBounds, equals, equalTo, getByteBuffer, getCapacity, getCumulativeOffset, getCumulativeOffset, getRegionOffset, getRegionOffset, getTypeByteOrder, hasArray, hasByteBuffer, hashCode, isByteOrderCompatible, isDirect, isReadOnly, isSameResource, isValid, toHexString, xxHash64, xxHash64
-
-
-
-
Method Detail
-
incrementPosition
BaseBuffer incrementPosition(long increment)
Increments the current position by the given increment. Asserts that the resource is valid and that the positional invariants are not violated, otherwise, if asserts are enabled throws anAssertionError
.- Parameters:
increment
- the given increment- Returns:
- BaseBuffer
-
incrementAndCheckPosition
BaseBuffer incrementAndCheckPosition(long increment)
Increments the current position by the given increment. Checks that the resource is valid and that the positional invariants are not violated, otherwise throws anIllegalArgumentException
.- Parameters:
increment
- the given increment- Returns:
- BaseBuffer
-
getEnd
long getEnd()
Gets the end position- Returns:
- the end position
-
getPosition
long getPosition()
Gets the current position- Returns:
- the current position
-
getStart
long getStart()
Gets start position- Returns:
- start position
-
getRemaining
long getRemaining()
The number of elements remaining between the current position and the end position- Returns:
(end - position)
-
hasRemaining
boolean hasRemaining()
Returns true if there are elements remaining between the current position and the end position- Returns:
(end - position) > 0
-
resetPosition
BaseBuffer resetPosition()
Resets the current position to the start position, This does not modify any data.- Returns:
- BaseBuffer
-
setPosition
BaseBuffer setPosition(long position)
Sets the current position. Asserts that the positional invariants are not violated, otherwise, if asserts are enabled throws anAssertionError
.- Parameters:
position
- the given current position.- Returns:
- BaseBuffer
-
setAndCheckPosition
BaseBuffer setAndCheckPosition(long position)
Sets the current position. Checks that the positional invariants are not violated, otherwise, throws anIllegalArgumentException
.- Parameters:
position
- the given current position.- Returns:
- BaseBuffer
-
setStartPositionEnd
BaseBuffer setStartPositionEnd(long start, long position, long end)
Sets start position, current position, and end position. Asserts that the positional invariants are not violated, otherwise, if asserts are enabled throws anAssertionError
.- Parameters:
start
- the start position in the bufferposition
- the current position between the start and endend
- the end position in the buffer- Returns:
- BaseBuffer
-
setAndCheckStartPositionEnd
BaseBuffer setAndCheckStartPositionEnd(long start, long position, long end)
Sets start position, current position, and end position. Checks that the positional invariants are not violated, otherwise, throws anIllegalArgumentException
.- Parameters:
start
- the start position in the bufferposition
- the current position between the start and endend
- the end position in the buffer- Returns:
- BaseBuffer
-
-