ly.img.android.pesdk.backend.exif / IOUtils / copy

copy

static fun copy(input: java.io.InputStream, output: java.io.OutputStream): int

Copy bytes from an InputStream to an OutputStream.

This method buffers the input internally, so there is no need to use a BufferedInputStream.

Large streams (over 2GB) will return a bytes copied value of -1 after the copy has completed since the correct number of bytes cannot be returned as an int. For large streams use the copyLarge(InputStream, OutputStream) method.

Parameters

input - java.io.InputStream: the InputStream to read from

output - java.io.OutputStream: the OutputStream to write to

Exceptions

NullPointerException - if the input or output is null

IOException - if an I/O error occurs

ArithmeticException - if the byte count is too large

Return
int: the number of bytes copied

Since
Commons IO 1.1

static fun copy(input: java.io.InputStream, output: java.io.Writer): void

Copy bytes from an InputStream to chars on a Writer using the default character encoding of the platform.

This method buffers the input internally, so there is no need to use a BufferedInputStream.

This method uses InputStreamReader.

Parameters

input - java.io.InputStream: the InputStream to read from

output - java.io.Writer: the Writer to write to

Exceptions

NullPointerException - if the input or output is null

IOException - if an I/O error occurs

Since
Commons IO 1.1

static fun copy(input: java.io.InputStream, output: java.io.Writer, encoding: java.lang.String): void

Copy bytes from an InputStream to chars on a Writer using the specified character encoding.

This method buffers the input internally, so there is no need to use a BufferedInputStream.

Character encoding names can be found at IANA.

This method uses InputStreamReader.

Parameters

input - java.io.InputStream: the InputStream to read from

output - java.io.Writer: the Writer to write to

encoding - java.lang.String: the encoding to use, null means platform default

Exceptions

NullPointerException - if the input or output is null

IOException - if an I/O error occurs

Since
Commons IO 1.1

static fun copy(input: java.io.Reader, output: java.io.Writer): int

Copy chars from a Reader to a Writer.

This method buffers the input internally, so there is no need to use a BufferedReader.

Large streams (over 2GB) will return a chars copied value of -1 after the copy has completed since the correct number of chars cannot be returned as an int. For large streams use the copyLarge(Reader, Writer) method.

Parameters

input - java.io.Reader: the Reader to read from

output - java.io.Writer: the Writer to write to

Exceptions

NullPointerException - if the input or output is null

IOException - if an I/O error occurs

ArithmeticException - if the character count is too large

Return
int: the number of characters copied

Since
Commons IO 1.1

static fun copy(input: java.io.Reader, output: java.io.OutputStream): void

Copy chars from a Reader to bytes on an OutputStream using the default character encoding of the platform, and calling flush.

This method buffers the input internally, so there is no need to use a BufferedReader.

Due to the implementation of OutputStreamWriter, this method performs a flush.

This method uses OutputStreamWriter.

Parameters

input - java.io.Reader: the Reader to read from

output - java.io.OutputStream: the OutputStream to write to

Exceptions

NullPointerException - if the input or output is null

IOException - if an I/O error occurs

Since
Commons IO 1.1

static fun copy(input: java.io.Reader, output: java.io.OutputStream, encoding: java.lang.String): void

Copy chars from a Reader to bytes on an OutputStream using the specified character encoding, and calling flush.

This method buffers the input internally, so there is no need to use a BufferedReader.

Character encoding names can be found at IANA.

Due to the implementation of OutputStreamWriter, this method performs a flush.

This method uses OutputStreamWriter.

Parameters

input - java.io.Reader: the Reader to read from

output - java.io.OutputStream: the OutputStream to write to

encoding - java.lang.String: the encoding to use, null means platform default

Exceptions

NullPointerException - if the input or output is null

IOException - if an I/O error occurs

Since
Commons IO 1.1