The list of methods to do InputStream Copy are organized into topic(s).
void
copyBytes(DataInput in, DataOutput out, int length, byte[] buf) Copies the specified number of bytes from the given DataInput to the given DataOutput.
int numLoops = length >> BUF_LEN_LOG_2;
for (int count = 0; count < numLoops; count++) {
in.readFully(buf);
out.write(buf);
in.readFully(buf, 0, length & BUF_LEN_MASK);
out.write(buf, 0, length & BUF_LEN_MASK);
int
copyBytes(InputStream in, OutputStream out) copy Bytes
if (in == null || out == null) {
throw new IllegalArgumentException("In/OutStream cannot be null");
int total = 0;
byte[] buffer = new byte[BUFFERSIZE];
for (int bytesRead; (bytesRead = in.read(buffer)) != -1;) {
out.write(buffer, 0, bytesRead);
total += bytesRead;
...
void
copyBytes(InputStream in, OutputStream out, int bufferSize, boolean close) Copy uninterpreted bytes from an input stream to an output stream.
BufferedInputStream from = new BufferedInputStream(in);
BufferedOutputStream to = new BufferedOutputStream(out);
byte[] bytes = new byte[bufferSize];
int size;
while ((size = from.read(bytes, 0, bufferSize)) >= 0) {
to.write(bytes, 0, size);
if (close) {
...
void
copyBytes(InputStream in, OutputStream out, int buffSize) Copies from one stream to another.
PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null;
byte buf[] = new byte[buffSize];
int bytesRead = in.read(buf);
while (bytesRead >= 0) {
out.write(buf, 0, bytesRead);
if ((ps != null) && ps.checkError()) {
throw new IOException("Unable to write to output stream.");
bytesRead = in.read(buf);
long
copyLarge(final InputStream input, final OutputStream output) Copies bytes from a large (over 2GB)
InputStream to an
OutputStream.
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
long count = 0;
int n = 0;
while (-1 != (n = input.read(buffer))) {
output.write(buffer, 0, n);
count += n;
return count;
...