MCPcopy Index your code
hub / github.com/antlr/codebuff / read

Method read

output/java_guava/1.4.17/ByteStreams.java:880–899  ·  view source on GitHub ↗

Reads some bytes from an input stream and stores them into the buffer array b. This method blocks until len bytes of input data have been read into the array, or end of file is detected. The number of bytes read is returned, possibly zero. Does not close the stream. A caller can

(InputStream in, byte[] b, int off, int len)

Source from the content-addressed store, hash-verified

878 */
879
880 @CanIgnoreReturnValue
881 // Sometimes you don't care how many bytes you actually read, I guess.
882 // (You know that it's either going to read len bytes or stop at EOF.)
883 public static int read(InputStream in, byte[] b, int off, int len) throws IOException {
884 checkNotNull(in);
885 checkNotNull(b);
886 if (len < 0) {
887 throw new IndexOutOfBoundsException("len is negative");
888 }
889
890 int total = 0;
891 while (total < len) {
892 int result = in.read(b, off + total, len - total);
893 if (result == -1) {
894 break;
895 }
896 total += result;
897 }
898 return total;
899 }
900}

Callers 8

contentEqualsMethod · 0.95
readFullyMethod · 0.95
copyMethod · 0.45
toByteArrayMethod · 0.45
exhaustMethod · 0.45
readMethod · 0.45
skipUpToMethod · 0.45
readBytesMethod · 0.45

Calls 1

checkNotNullMethod · 0.45

Tested by

no test coverage detected