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

Method copy

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

Copies all bytes from the input stream to the output stream. Does not close or flush either stream. @param from the input stream to read from @param to the output stream to write to @return the number of bytes copied @throws IOException if an I/O error occurs

(InputStream from, OutputStream to)

Source from the content-addressed store, hash-verified

98 * @throws IOException if an I/O error occurs
99 */
100 @CanIgnoreReturnValue
101 public static long copy(InputStream from, OutputStream to) throws IOException {
102 checkNotNull(from);
103 checkNotNull(to);
104 byte[] buf = createBuffer();
105 long total = 0;
106 while (true) {
107 int r = from.read(buf);
108 if (r == -1) {
109 break;
110 }
111 to.write(buf, 0, r);
112 total += r;
113 }
114 return total;
115 }
116
117 /**
118 * Copies all bytes from the readable channel to the writable channel. Does not close or flush

Callers 3

writeFromMethod · 0.95
copyToMethod · 0.95
toByteArrayMethod · 0.95

Calls 9

createBufferMethod · 0.95
writeMethod · 0.65
sizeMethod · 0.65
clearMethod · 0.65
checkNotNullMethod · 0.45
readMethod · 0.45
wrapMethod · 0.45
flipMethod · 0.45
hasRemainingMethod · 0.45

Tested by

no test coverage detected