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

com.github.rmannibucau.featuredmock.util.IOs Maven / Gradle / Ivy

There is a newer version: 0.4
Show newest version
package com.github.rmannibucau.featuredmock.util;

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

public final class IOs {
    private static final int BUFFER_SIZE = 1024;

    public static byte[] slurp(final InputStream is) throws IOException {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream(BUFFER_SIZE);
        int r;
        while ((r = is.read()) != -1) {
            baos.write(r);
        }
        return baos.toByteArray();
    }

    private IOs() {
        // no-op
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy