public static HasInputStream lazyStream(final InputStream data) {
        return new HasInputStream() {
            @Override
            public InputStream getInputStream() throws IOException {
                return data;
            }

            @Override
            public long writeContent(OutputStream outputStream) throws IOException {
                return copyStream(data, outputStream);
            }
        };
    }
public static HasInputStream lazyStream ( final InputStream data ) { return new HasInputStream ( ) { @ Override public InputStream getInputStream ( ) throws IOException { return data ; } @ Override public long writeContent ( OutputStream outputStream ) throws IOException { return copyStream ( data , outputStream ) ; } } ; }
Lazy mechanism for stream loading

@param data file

@return lazy stream