MCPcopy Create free account
hub / github.com/antlr/codebuff / copy

Method copy

corpus/java/training/guava/io/CharStreams.java:69–82  ·  view source on GitHub ↗

Copies all characters between the Readable and Appendable objects. Does not close or flush either object. @param from the object to read from @param to the object to write to @return the number of characters copied @throws IOException if an I/O error occurs

(Readable from, Appendable to)

Source from the content-addressed store, hash-verified

67 * @throws IOException if an I/O error occurs
68 */
69 @CanIgnoreReturnValue
70 public static long copy(Readable from, Appendable to) throws IOException {
71 checkNotNull(from);
72 checkNotNull(to);
73 CharBuffer buf = createBuffer();
74 long total = 0;
75 while (from.read(buf) != -1) {
76 buf.flip();
77 to.append(buf);
78 total += buf.remaining();
79 buf.clear();
80 }
81 return total;
82 }
83
84 /**
85 * Reads all characters from a {@link Readable} object into a {@link String}. Does not close the

Callers 3

toStringBuilderMethod · 0.95
writeFromMethod · 0.95
copyToMethod · 0.95

Calls 7

createBufferMethod · 0.95
clearMethod · 0.65
checkNotNullMethod · 0.45
readMethod · 0.45
flipMethod · 0.45
appendMethod · 0.45
remainingMethod · 0.45

Tested by

no test coverage detected