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

Method copy

output/java_guava/1.4.17/ByteStreams.java:102–117  ·  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

100 */
101
102 @CanIgnoreReturnValue
103 public static long copy(InputStream from, OutputStream to) throws IOException {
104 checkNotNull(from);
105 checkNotNull(to);
106 byte[] buf = createBuffer();
107 long total = 0;
108 while (true) {
109 int r = from.read(buf);
110 if (r == -1) {
111 break;
112 }
113 to.write(buf, 0, r);
114 total += r;
115 }
116 return total;
117 }
118
119 /**
120 * 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