All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.restassured.internal.util.IOUtils Maven / Gradle / Ivy

There is a newer version: 5.5.0
Show newest version
package io.restassured.internal.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class IOUtils {

    public static byte[] toByteArray(InputStream stream) throws IOException {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        int nRead;
        byte[] data = new byte[16384];

        while ((nRead = stream.read(data, 0, data.length)) != -1) {
            buffer.write(data, 0, nRead);
        }
        return buffer.toByteArray();

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy