25
25
/**
26
26
* A block packs positionCount values into a chunk of memory. How the values are packed,
27
27
* whether compression is used, endianness, and other implementation details are up to the subclasses.
28
- * However, for purposes of API, you can think of a Block as a sequence of values that
28
+ * However, for purposes of API, you can think of a Block as a sequence of zero-indexed values that
29
29
* can be read by calling the getter methods in this interface. For instance,
30
30
* you can read positionCount bytes by calling
31
31
* block.getByte(0), block.getByte(1), ... block.getByte(positionCount - 1).
@@ -51,6 +51,8 @@ default int getSliceLength(int position)
51
51
52
52
/**
53
53
* Gets a byte in the value at {@code position}.
54
+ *
55
+ * @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
54
56
*/
55
57
default byte getByte (int position )
56
58
{
@@ -59,6 +61,8 @@ default byte getByte(int position)
59
61
60
62
/**
61
63
* Gets a short in the value at {@code position}.
64
+ *
65
+ * @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
62
66
*/
63
67
default short getShort (int position )
64
68
{
@@ -67,6 +71,8 @@ default short getShort(int position)
67
71
68
72
/**
69
73
* Gets an int in the value at {@code position}.
74
+ *
75
+ * @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
70
76
*/
71
77
default int getInt (int position )
72
78
{
@@ -75,6 +81,8 @@ default int getInt(int position)
75
81
76
82
/**
77
83
* Gets a long in the value at {@code position}.
84
+ *
85
+ * @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
78
86
*/
79
87
default long getLong (int position )
80
88
{
@@ -99,15 +107,16 @@ default Slice getSlice(int position, int offset, int length)
99
107
100
108
/**
101
109
* Gets a block in the value at {@code position}.
102
- * @return
110
+ *
111
+ * @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
103
112
*/
104
113
default Block getBlock (int position )
105
114
{
106
115
throw new UnsupportedOperationException (getClass ().getName ());
107
116
}
108
117
109
118
/**
110
- * Is the byte sequences at {@code offset} in the value at {@code position} equal
119
+ * Is the byte sequence at {@code offset} in the value at {@code position} equal
111
120
* to the byte sequence at {@code otherOffset} in {@code otherSlice}.
112
121
* This method must be implemented if @{code getSlice} is implemented.
113
122
*/
@@ -147,7 +156,7 @@ default void writeBytesTo(int position, int offset, int length, SliceOutput slic
147
156
}
148
157
149
158
/**
150
- * Appends the value at {@code position} to {@code blockBuilder} and close the entry.
159
+ * Appends the value at {@code position} to {@code blockBuilder} and closes the entry.
151
160
*/
152
161
void writePositionTo (int position , BlockBuilder blockBuilder );
153
162
@@ -378,12 +387,14 @@ default Block getLoadedBlock()
378
387
Block appendNull ();
379
388
380
389
/**
381
- * Returns the converted long value at {@code position} if the value ar {@code position} can be converted to long.
382
- * @throws UnsupportedOperationException if value at {@code position} is not compatible to be converted to long.
390
+ * Returns the converted long value at {@code position} if the value at {@code position} can be converted to long.
383
391
*
384
392
* Difference between toLong() and getLong() is:
385
393
* getLong() would only return value when the block is LongArrayBlock, otherwise it would throw exception.
386
394
* toLong() would return value for compatible types: LongArrayBlock, IntArrayBlock, ByteArrayBlock and ShortArrayBlock.
395
+ *
396
+ * @throws UnsupportedOperationException if value at {@code position} is not able to be converted to long.
397
+ * @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
387
398
*/
388
399
default long toLong (int position )
389
400
{
0 commit comments