@@ -89,23 +89,20 @@ public ByteBufferInput (InputStream inputStream, int bufferSize) {
89
89
/** Throws {@link UnsupportedOperationException} because this input uses a ByteBuffer, not a byte[].
90
90
* @deprecated
91
91
* @see #getByteBuffer() */
92
- @ Override
93
92
public byte [] getBuffer () {
94
93
throw new UnsupportedOperationException ("This input does not used a byte[], see #getByteBuffer()." );
95
94
}
96
95
97
96
/** Throws {@link UnsupportedOperationException} because this input uses a ByteBuffer, not a byte[].
98
97
* @deprecated
99
98
* @see #setBuffer(ByteBuffer) */
100
- @ Override
101
99
public void setBuffer (byte [] bytes ) {
102
100
throw new UnsupportedOperationException ("This input does not used a byte[], see #setByteBuffer(ByteBuffer)." );
103
101
}
104
102
105
103
/** Throws {@link UnsupportedOperationException} because this input uses a ByteBuffer, not a byte[].
106
104
* @deprecated
107
105
* @see #setBuffer(ByteBuffer) */
108
- @ Override
109
106
public void setBuffer (byte [] bytes , int offset , int count ) {
110
107
throw new UnsupportedOperationException ("This input does not used a byte[], see #setByteBufferByteBuffer()." );
111
108
}
@@ -127,14 +124,12 @@ public ByteBuffer getByteBuffer () {
127
124
return byteBuffer ;
128
125
}
129
126
130
- @ Override
131
127
public void setInputStream (InputStream inputStream ) {
132
128
this .inputStream = inputStream ;
133
129
limit = 0 ;
134
130
reset ();
135
131
}
136
132
137
- @ Override
138
133
public void reset () {
139
134
super .reset ();
140
135
setBufferPosition (byteBuffer , 0 );
@@ -164,7 +159,6 @@ protected int fill (ByteBuffer buffer, int offset, int count) throws KryoExcepti
164
159
}
165
160
}
166
161
167
- @ Override
168
162
protected int require (int required ) throws KryoException {
169
163
int remaining = limit - position ;
170
164
if (remaining >= required ) return remaining ;
@@ -208,7 +202,6 @@ protected int require (int required) throws KryoException {
208
202
* @param optional Must be > 0.
209
203
* @return the number of bytes remaining, but not more than optional, or -1 if {@link #fill(ByteBuffer, int, int)} is unable to
210
204
* provide more bytes. */
211
- @ Override
212
205
protected int optional (int optional ) throws KryoException {
213
206
int remaining = limit - position ;
214
207
if (remaining >= optional ) return optional ;
@@ -243,19 +236,16 @@ protected int optional (int optional) throws KryoException {
243
236
244
237
// InputStream:
245
238
246
- @ Override
247
239
public int read () throws KryoException {
248
240
if (optional (1 ) <= 0 ) return -1 ;
249
241
position ++;
250
242
return byteBuffer .get () & 0xFF ;
251
243
}
252
244
253
- @ Override
254
245
public int read (byte [] bytes ) throws KryoException {
255
246
return read (bytes , 0 , bytes .length );
256
247
}
257
248
258
- @ Override
259
249
public int read (byte [] bytes , int offset , int count ) throws KryoException {
260
250
if (bytes == null ) throw new IllegalArgumentException ("bytes cannot be null." );
261
251
int startingCount = count ;
@@ -277,25 +267,21 @@ public int read (byte[] bytes, int offset, int count) throws KryoException {
277
267
return startingCount - count ;
278
268
}
279
269
280
- @ Override
281
270
public void setPosition (int position ) {
282
271
this .position = position ;
283
272
setBufferPosition (byteBuffer , position );
284
273
}
285
274
286
- @ Override
287
275
public void setLimit (int limit ) {
288
276
this .limit = limit ;
289
277
setBufferLimit (byteBuffer , limit );
290
278
}
291
279
292
- @ Override
293
280
public void skip (int count ) throws KryoException {
294
281
super .skip (count );
295
282
setBufferPosition (byteBuffer , position );
296
283
}
297
284
298
- @ Override
299
285
public long skip (long count ) throws KryoException {
300
286
long remaining = count ;
301
287
while (remaining > 0 ) {
@@ -306,7 +292,6 @@ public long skip (long count) throws KryoException {
306
292
return count ;
307
293
}
308
294
309
- @ Override
310
295
public void close () throws KryoException {
311
296
if (inputStream != null ) {
312
297
try {
@@ -334,28 +319,24 @@ private void flipBuffer (Buffer buffer) {
334
319
335
320
// byte:
336
321
337
- @ Override
338
322
public byte readByte () throws KryoException {
339
323
if (position == limit ) require (1 );
340
324
position ++;
341
325
return byteBuffer .get ();
342
326
}
343
327
344
- @ Override
345
328
public int readByteUnsigned () throws KryoException {
346
329
if (position == limit ) require (1 );
347
330
position ++;
348
331
return byteBuffer .get () & 0xFF ;
349
332
}
350
333
351
- @ Override
352
334
public byte [] readBytes (int length ) throws KryoException {
353
335
byte [] bytes = new byte [length ];
354
336
readBytes (bytes , 0 , length );
355
337
return bytes ;
356
338
}
357
339
358
- @ Override
359
340
public void readBytes (byte [] bytes , int offset , int count ) throws KryoException {
360
341
if (bytes == null ) throw new IllegalArgumentException ("bytes cannot be null." );
361
342
int copyCount = Math .min (limit - position , count );
@@ -372,7 +353,6 @@ public void readBytes (byte[] bytes, int offset, int count) throws KryoException
372
353
373
354
// int:
374
355
375
- @ Override
376
356
public int readInt () throws KryoException {
377
357
require (4 );
378
358
position += 4 ;
@@ -383,7 +363,6 @@ public int readInt () throws KryoException {
383
363
| (byteBuffer .get () & 0xFF ) << 24 ;
384
364
}
385
365
386
- @ Override
387
366
public int readVarInt (boolean optimizePositive ) throws KryoException {
388
367
if (require (1 ) < 5 ) return readVarInt_slow (optimizePositive );
389
368
int b = byteBuffer .get ();
@@ -442,7 +421,6 @@ private int readVarInt_slow (boolean optimizePositive) {
442
421
return optimizePositive ? result : ((result >>> 1 ) ^ -(result & 1 ));
443
422
}
444
423
445
- @ Override
446
424
public boolean canReadVarInt () throws KryoException {
447
425
if (limit - position >= 5 ) return true ;
448
426
if (optional (5 ) <= 0 ) return false ;
@@ -461,15 +439,13 @@ public boolean canReadVarInt () throws KryoException {
461
439
462
440
/** Reads the boolean part of a varint flag. The position is not advanced, {@link #readVarIntFlag(boolean)} should be used to
463
441
* advance the position. */
464
- @ Override
465
442
public boolean readVarIntFlag () {
466
443
if (position == limit ) require (1 );
467
444
return (byteBuffer .get (position ) & 0x80 ) != 0 ;
468
445
}
469
446
470
447
/** Reads the 1-5 byte int part of a varint flag. The position is advanced so if the boolean part is needed it should be read
471
448
* first with {@link #readVarIntFlag()}. */
472
- @ Override
473
449
public int readVarIntFlag (boolean optimizePositive ) {
474
450
if (require (1 ) < 5 ) return readVarIntFlag_slow (optimizePositive );
475
451
int b = byteBuffer .get ();
@@ -530,7 +506,6 @@ private int readVarIntFlag_slow (boolean optimizePositive) {
530
506
531
507
// long:
532
508
533
- @ Override
534
509
public long readLong () throws KryoException {
535
510
require (8 );
536
511
position += 8 ;
@@ -545,7 +520,6 @@ public long readLong () throws KryoException {
545
520
| (long )byteBuffer .get () << 56 ;
546
521
}
547
522
548
- @ Override
549
523
public long readVarLong (boolean optimizePositive ) throws KryoException {
550
524
if (require (1 ) < 9 ) return readVarLong_slow (optimizePositive );
551
525
int b = byteBuffer .get ();
@@ -644,7 +618,6 @@ private long readVarLong_slow (boolean optimizePositive) {
644
618
return optimizePositive ? result : ((result >>> 1 ) ^ -(result & 1 ));
645
619
}
646
620
647
- @ Override
648
621
public boolean canReadVarLong () throws KryoException {
649
622
if (limit - position >= 9 ) return true ;
650
623
if (optional (5 ) <= 0 ) return false ;
@@ -671,7 +644,6 @@ public boolean canReadVarLong () throws KryoException {
671
644
672
645
// float:
673
646
674
- @ Override
675
647
public float readFloat () throws KryoException {
676
648
require (4 );
677
649
ByteBuffer byteBuffer = this .byteBuffer ;
@@ -685,7 +657,6 @@ public float readFloat () throws KryoException {
685
657
686
658
// double:
687
659
688
- @ Override
689
660
public double readDouble () throws KryoException {
690
661
require (8 );
691
662
ByteBuffer byteBuffer = this .byteBuffer ;
@@ -703,7 +674,6 @@ public double readDouble () throws KryoException {
703
674
704
675
// boolean:
705
676
706
- @ Override
707
677
public boolean readBoolean () throws KryoException {
708
678
if (position == limit ) require (1 );
709
679
position ++;
@@ -712,14 +682,12 @@ public boolean readBoolean () throws KryoException {
712
682
713
683
// short:
714
684
715
- @ Override
716
685
public short readShort () throws KryoException {
717
686
require (2 );
718
687
position += 2 ;
719
688
return (short )((byteBuffer .get () & 0xFF ) | ((byteBuffer .get () & 0xFF ) << 8 ));
720
689
}
721
690
722
- @ Override
723
691
public int readShortUnsigned () throws KryoException {
724
692
require (2 );
725
693
position += 2 ;
@@ -728,7 +696,6 @@ public int readShortUnsigned () throws KryoException {
728
696
729
697
// char:
730
698
731
- @ Override
732
699
public char readChar () throws KryoException {
733
700
require (2 );
734
701
position += 2 ;
@@ -737,7 +704,6 @@ public char readChar () throws KryoException {
737
704
738
705
// String:
739
706
740
- @ Override
741
707
public String readString () {
742
708
if (!readVarIntFlag ()) return readAsciiString (); // ASCII.
743
709
// Null, empty, or UTF8.
@@ -753,7 +719,6 @@ public String readString () {
753
719
return new String (chars , 0 , charCount );
754
720
}
755
721
756
- @ Override
757
722
public StringBuilder readStringBuilder () {
758
723
if (!readVarIntFlag ()) return new StringBuilder (readAsciiString ()); // ASCII.
759
724
// Null, empty, or UTF8.
@@ -867,7 +832,6 @@ private String readAscii_slow (int charCount) {
867
832
868
833
// Primitive arrays:
869
834
870
- @ Override
871
835
public int [] readInts (int length ) throws KryoException {
872
836
int [] array = new int [length ];
873
837
if (optional (length << 2 ) == length << 2 ) {
@@ -886,7 +850,6 @@ public int[] readInts (int length) throws KryoException {
886
850
return array ;
887
851
}
888
852
889
- @ Override
890
853
public long [] readLongs (int length ) throws KryoException {
891
854
long [] array = new long [length ];
892
855
if (optional (length << 3 ) == length << 3 ) {
@@ -909,7 +872,6 @@ public long[] readLongs (int length) throws KryoException {
909
872
return array ;
910
873
}
911
874
912
- @ Override
913
875
public float [] readFloats (int length ) throws KryoException {
914
876
float [] array = new float [length ];
915
877
if (optional (length << 2 ) == length << 2 ) {
@@ -928,7 +890,6 @@ public float[] readFloats (int length) throws KryoException {
928
890
return array ;
929
891
}
930
892
931
- @ Override
932
893
public double [] readDoubles (int length ) throws KryoException {
933
894
double [] array = new double [length ];
934
895
if (optional (length << 3 ) == length << 3 ) {
@@ -951,7 +912,6 @@ public double[] readDoubles (int length) throws KryoException {
951
912
return array ;
952
913
}
953
914
954
- @ Override
955
915
public short [] readShorts (int length ) throws KryoException {
956
916
short [] array = new short [length ];
957
917
if (optional (length << 1 ) == length << 1 ) {
@@ -966,7 +926,6 @@ public short[] readShorts (int length) throws KryoException {
966
926
return array ;
967
927
}
968
928
969
- @ Override
970
929
public char [] readChars (int length ) throws KryoException {
971
930
char [] array = new char [length ];
972
931
if (optional (length << 1 ) == length << 1 ) {
@@ -981,7 +940,6 @@ public char[] readChars (int length) throws KryoException {
981
940
return array ;
982
941
}
983
942
984
- @ Override
985
943
public boolean [] readBooleans (int length ) throws KryoException {
986
944
boolean [] array = new boolean [length ];
987
945
if (optional (length ) == length ) {
0 commit comments