48
48
* @author Colin Decker
49
49
* @since 1.0
50
50
*/
51
- @ Beta
52
51
@ GwtIncompatible
53
52
public final class ByteStreams {
54
53
@@ -266,6 +265,7 @@ static byte[] toByteArray(InputStream in, long expectedSize) throws IOException
266
265
* @since 20.0
267
266
*/
268
267
@ CanIgnoreReturnValue
268
+ @ Beta
269
269
public static long exhaust (InputStream in ) throws IOException {
270
270
long total = 0 ;
271
271
long read ;
@@ -280,6 +280,7 @@ public static long exhaust(InputStream in) throws IOException {
280
280
* Returns a new {@link ByteArrayDataInput} instance to read from the {@code bytes} array from the
281
281
* beginning.
282
282
*/
283
+ @ Beta
283
284
public static ByteArrayDataInput newDataInput (byte [] bytes ) {
284
285
return newDataInput (new ByteArrayInputStream (bytes ));
285
286
}
@@ -291,6 +292,7 @@ public static ByteArrayDataInput newDataInput(byte[] bytes) {
291
292
* @throws IndexOutOfBoundsException if {@code start} is negative or greater than the length of
292
293
* the array
293
294
*/
295
+ @ Beta
294
296
public static ByteArrayDataInput newDataInput (byte [] bytes , int start ) {
295
297
checkPositionIndex (start , bytes .length );
296
298
return newDataInput (new ByteArrayInputStream (bytes , start , bytes .length - start ));
@@ -303,6 +305,7 @@ public static ByteArrayDataInput newDataInput(byte[] bytes, int start) {
303
305
*
304
306
* @since 17.0
305
307
*/
308
+ @ Beta
306
309
public static ByteArrayDataInput newDataInput (ByteArrayInputStream byteArrayInputStream ) {
307
310
return new ByteArrayDataInputStream (checkNotNull (byteArrayInputStream ));
308
311
}
@@ -453,6 +456,7 @@ public String readUTF() {
453
456
}
454
457
455
458
/** Returns a new {@link ByteArrayDataOutput} instance with a default size. */
459
+ @ Beta
456
460
public static ByteArrayDataOutput newDataOutput () {
457
461
return newDataOutput (new ByteArrayOutputStream ());
458
462
}
@@ -463,6 +467,7 @@ public static ByteArrayDataOutput newDataOutput() {
463
467
*
464
468
* @throws IllegalArgumentException if {@code size} is negative
465
469
*/
470
+ @ Beta
466
471
public static ByteArrayDataOutput newDataOutput (int size ) {
467
472
// When called at high frequency, boxing size generates too much garbage,
468
473
// so avoid doing that if we can.
@@ -484,6 +489,7 @@ public static ByteArrayDataOutput newDataOutput(int size) {
484
489
*
485
490
* @since 17.0
486
491
*/
492
+ @ Beta
487
493
public static ByteArrayDataOutput newDataOutput (ByteArrayOutputStream byteArrayOutputSteam ) {
488
494
return new ByteArrayDataOutputStream (checkNotNull (byteArrayOutputSteam ));
489
495
}
@@ -659,6 +665,7 @@ public String toString() {
659
665
*
660
666
* @since 14.0 (since 1.0 as com.google.common.io.NullOutputStream)
661
667
*/
668
+ @ Beta
662
669
public static OutputStream nullOutputStream () {
663
670
return NULL_OUTPUT_STREAM ;
664
671
}
@@ -671,6 +678,7 @@ public static OutputStream nullOutputStream() {
671
678
* @return a length-limited {@link InputStream}
672
679
* @since 14.0 (since 1.0 as com.google.common.io.LimitInputStream)
673
680
*/
681
+ @ Beta
674
682
public static InputStream limit (InputStream in , long limit ) {
675
683
return new LimitedInputStream (in , limit );
676
684
}
@@ -757,6 +765,7 @@ public long skip(long n) throws IOException {
757
765
* @throws EOFException if this stream reaches the end before reading all the bytes.
758
766
* @throws IOException if an I/O error occurs.
759
767
*/
768
+ @ Beta
760
769
public static void readFully (InputStream in , byte [] b ) throws IOException {
761
770
readFully (in , b , 0 , b .length );
762
771
}
@@ -773,6 +782,7 @@ public static void readFully(InputStream in, byte[] b) throws IOException {
773
782
* @throws EOFException if this stream reaches the end before reading all the bytes.
774
783
* @throws IOException if an I/O error occurs.
775
784
*/
785
+ @ Beta
776
786
public static void readFully (InputStream in , byte [] b , int off , int len ) throws IOException {
777
787
int read = read (in , b , off , len );
778
788
if (read != len ) {
@@ -790,6 +800,7 @@ public static void readFully(InputStream in, byte[] b, int off, int len) throws
790
800
* @throws EOFException if this stream reaches the end before skipping all the bytes
791
801
* @throws IOException if an I/O error occurs, or the stream does not support skipping
792
802
*/
803
+ @ Beta
793
804
public static void skipFully (InputStream in , long n ) throws IOException {
794
805
long skipped = skipUpTo (in , n );
795
806
if (skipped < n ) {
@@ -848,6 +859,7 @@ private static long skipSafely(InputStream in, long n) throws IOException {
848
859
* @throws IOException if an I/O error occurs
849
860
* @since 14.0
850
861
*/
862
+ @ Beta
851
863
@ CanIgnoreReturnValue // some processors won't return a useful result
852
864
public static <T > T readBytes (InputStream input , ByteProcessor <T > processor ) throws IOException {
853
865
checkNotNull (input );
@@ -883,6 +895,7 @@ public static <T> T readBytes(InputStream input, ByteProcessor<T> processor) thr
883
895
* @return the number of bytes read
884
896
* @throws IOException if an I/O error occurs
885
897
*/
898
+ @ Beta
886
899
@ CanIgnoreReturnValue
887
900
// Sometimes you don't care how many bytes you actually read, I guess.
888
901
// (You know that it's either going to read len bytes or stop at EOF.)
0 commit comments