
Java: da un InputStream ad un array di byte
Questa semplice funzione prende in ingresso un InputStream e restituisce un array di byte. public static byte[] readBytes(InputStream inputStream) throws IOException { …
Questa semplice funzione prende in ingresso un InputStream e restituisce un array di byte. public static byte[] readBytes(InputStream inputStream) throws IOException { …
Ecco la funzione che utilizza un ByteArrayOutputStream: public static byte[] gzip(byte[] data) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); …