MCPcopy Index your code
hub / github.com/facebook/SoLoader / copyBytes

Method copyBytes

java/com/facebook/soloader/SysUtil.java:315–326  ·  view source on GitHub ↗

Copy up to byteLimit bytes from the input stream to the output stream. @param os Destination stream @param is Input stream @param byteLimit Maximum number of bytes to copy @param buffer IO buffer to use @return Number of bytes actually copied

(RandomAccessFile os, InputStream is, int byteLimit, byte[] buffer)

Source from the content-addressed store, hash-verified

313 * @return Number of bytes actually copied
314 */
315 static int copyBytes(RandomAccessFile os, InputStream is, int byteLimit, byte[] buffer)
316 throws IOException {
317 // Yes, this method is exactly the same as the above, just with a different type for `os'.
318 int bytesCopied = 0;
319 int nrRead;
320 while (bytesCopied < byteLimit
321 && (nrRead = is.read(buffer, 0, Math.min(buffer.length, byteLimit - bytesCopied))) != -1) {
322 os.write(buffer, 0, nrRead);
323 bytesCopied += nrRead;
324 }
325 return bytesCopied;
326 }
327
328 public static void fsyncAll(File fileName) throws IOException {
329 Stack<File> filesStack = new Stack<>();

Callers 1

extractDsoMethod · 0.95

Calls 2

readMethod · 0.65
writeMethod · 0.65

Tested by

no test coverage detected