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

com.github.chen0040.tensorflow.classifiers.utils.InputStreamUtils Maven / Gradle / Ivy

Go to download

Java implementation of music classifier, encoder, search engine and recommender using Tensorflow nd Java

The newest version!
package com.github.chen0040.tensorflow.classifiers.utils;

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

public class InputStreamUtils {
    public static byte[] getBytes(InputStream is) throws IOException {
        ByteArrayOutputStream mem = new ByteArrayOutputStream();
        byte[] buffer = new byte[1024];
        int len = 0;
        while((len = is.read(buffer, 0, 1024)) > 0){
            mem.write(buffer, 0, len);
        }
        return mem.toByteArray();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy