Java Reader Copy copyLarge(Reader input, Writer output, char[] buffer)

Here you can find the source of copyLarge(Reader input, Writer output, char[] buffer)

Description

copy Large

License

Apache License

Declaration

private static long copyLarge(Reader input, Writer output, char[] buffer) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import java.io.Reader;
import java.io.Writer;

public class Main {
    private static final int EOF = -1;
    private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;

    private static long copyLarge(InputStream input, OutputStream output) throws IOException {
        byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
        long count = 0;
        int n = 0;
        while (-1 != (n = input.read(buffer))) {
            output.write(buffer, 0, n);//from  www  .j av  a  2 s  . c om
            count += n;
        }
        return count;
    }

    private static long copyLarge(InputStream input, OutputStream output, byte[] buffer) throws IOException {
        long count = 0;
        int n = 0;
        while (EOF != (n = input.read(buffer))) {
            output.write(buffer, 0, n);
            count += n;
        }
        return count;
    }

    private static long copyLarge(Reader input, Writer output, char[] buffer) throws IOException {
        long count = 0;
        int n = 0;
        while (EOF != (n = input.read(buffer))) {
            output.write(buffer, 0, n);
            count += n;
        }
        return count;
    }
}

Related

  1. copyLarge(Reader input, Writer output)
  2. copyLarge(Reader input, Writer output)
  3. copyLarge(Reader input, Writer output)
  4. copyLarge(Reader input, Writer output)
  5. copyLarge(Reader input, Writer output, char[] buffer)
  6. copyLarge(Reader input, Writer output, char[] buffer)
  7. copyLarge(Reader input, Writer output, final long inputOffset, final long length, char[] buffer)
  8. copyLarge(Reader input, Writer output, long limit)