MCPcopy Index your code
hub / github.com/OpenFeign/feign / copy

Method copy

core/src/main/java/feign/Util.java:269–283  ·  view source on GitHub ↗

Adapted from com.google.common.io.ByteStreams.copy().

(InputStream from, OutputStream to)

Source from the content-addressed store, hash-verified

267
268 /** Adapted from {@code com.google.common.io.ByteStreams.copy()}. */
269 private static long copy(InputStream from, OutputStream to) throws IOException {
270 checkNotNull(from, "from");
271 checkNotNull(to, "to");
272 byte[] buf = new byte[BUF_SIZE];
273 long total = 0;
274 while (true) {
275 int r = from.read(buf);
276 if (r == -1) {
277 break;
278 }
279 to.write(buf, 0, r);
280 total += r;
281 }
282 return total;
283 }
284
285 public static String decodeOrDefault(byte[] data, Charset charset, String defaultValue) {
286 if (data == null) {

Callers 4

toByteArrayMethod · 0.95
toHttpUriRequestMethod · 0.80

Calls 3

checkNotNullMethod · 0.95
writeMethod · 0.65
readMethod · 0.45

Tested by

no test coverage detected