Search in sources :

Example 1 with DLInputStream

use of org.apache.pulsar.functions.worker.dlog.DLInputStream in project incubator-pulsar by apache.

the class Utils method downloadFromBookkeeper.

public static void downloadFromBookkeeper(Namespace namespace, OutputStream outputStream, String packagePath) throws Exception {
    DistributedLogManager dlm = namespace.openLog(packagePath);
    InputStream in = new DLInputStream(dlm);
    int read = 0;
    byte[] bytes = new byte[1024];
    while ((read = in.read(bytes)) != -1) {
        outputStream.write(bytes, 0, read);
    }
    outputStream.flush();
}
Also used : DLInputStream(org.apache.pulsar.functions.worker.dlog.DLInputStream) DistributedLogManager(org.apache.distributedlog.api.DistributedLogManager) ObjectInputStream(java.io.ObjectInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) DLInputStream(org.apache.pulsar.functions.worker.dlog.DLInputStream) InputStream(java.io.InputStream)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 DistributedLogManager (org.apache.distributedlog.api.DistributedLogManager)1 DLInputStream (org.apache.pulsar.functions.worker.dlog.DLInputStream)1