@@ -0,0 +1,1047 @@
+package util;%0A%0Aimport java.io.FileInputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.OutputStream;%0Aimport javax.ws.rs.WebApplicationException;%0Aimport javax.ws.rs.core.StreamingOutput;%0A%0A/**%0A *%0A * @author x%0A */%0Apublic class PipedStreamingOutput implements StreamingOutput %7B%0A%0A    private final InputStream in;%0A%0A    private final byte%5B%5D buffer;%0A%0A    public static PipedStreamingOutput from(InputStream src) %7B%0A        return new PipedStreamingOutput(src);%0A    %7D%0A%0A    public PipedStreamingOutput(InputStream src, int bufferSize) %7B%0A        this.in = src;%0A        buffer = new byte%5BbufferSize%5D;%0A    %7D%0A%0A    public PipedStreamingOutput(InputStream src) %7B%0A        this(src, 2048);%0A    %7D%0A%0A    @Override%0A    public void write(OutputStream out) throws IOException, WebApplicationException %7B%0A        int n;%0A        try (InputStream src = this.in; OutputStream dest = out) %7B%0A            while ((n = src.read(buffer)) %3E -1) %7B%0A                dest.write(buffer, 0, n);%0A                dest.flush();%0A            %7D%0A        %7D%0A    %7D%0A%0A%7D%0A

Create PipedStreamingOutput.java