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

Method toByteArray

corpus/java/training/guava/io/ByteStreams.java:162–169  ·  view source on GitHub ↗

Reads all bytes from an input stream into a byte array. Does not close the stream. @param in the input stream to read from @return a byte array containing all the bytes from the stream @throws IOException if an I/O error occurs

(InputStream in)

Source from the content-addressed store, hash-verified

160 * @throws IOException if an I/O error occurs
161 */
162 public static byte[] toByteArray(InputStream in) throws IOException {
163 // Presize the ByteArrayOutputStream since we know how large it will need
164 // to be, unless that value is less than the default ByteArrayOutputStream
165 // size (32).
166 ByteArrayOutputStream out = new ByteArrayOutputStream(Math.max(32, in.available()));
167 copy(in, out);
168 return out.toByteArray();
169 }
170
171 /**
172 * Reads all bytes from an input stream into a byte array. The given expected size is used to

Callers 2

readMethod · 0.95
readFileMethod · 0.95

Calls 9

copyMethod · 0.95
writeToMethod · 0.95
toByteArrayMethod · 0.65
writeMethod · 0.65
sizeMethod · 0.65
maxMethod · 0.45
availableMethod · 0.45
readMethod · 0.45
copyOfMethod · 0.45

Tested by

no test coverage detected