core/src/main/java/org/apache/commons/vfs2/FileUtil.java
/**
     * Writes the content of a file to an OutputStream.
     * @param file The FileObject to write.
     * @param outstr The OutputStream to write to.
     * @throws IOException if an error occurs writing the file.
     */
Writes the content of a file to an OutputStream.
@param file The FileObject to write.
@param outstr The OutputStream to write to.
@throws IOException if an error occurs writing the file.
Writes the content of a file to an OutputStream . @param file The FileObject to write . @param outstr The OutputStream to write to . @throws IOException if an error occurs writing the file .
public static void writeContent(final FileObject file,
                                    final OutputStream outstr)
        throws IOException
    {
        final InputStream instr = file.getContent().getInputStream();
        try
        {
            final byte[] buffer = new byte[BUFFER_SIZE];
            while (true)
            {
                final int nread = instr.read(buffer);
                if (nread < 0)
                {
                    break;
                }
                outstr.write(buffer, 0, nread);
            }
        }
        finally
        {
            instr.close();
        }
    }
public static void writeContent ( final FileObject file , final OutputStream outstr ) throws IOException { final InputStream instr = file . getContent ( ) . getInputStream ( ) ; try { final byte [ ] buffer = new byte [ BUFFER_SIZE ] ; while ( true ) { final int nread = instr . read ( buffer ) ; if ( nread < 0 ) { break ; } outstr . write ( buffer , 0 , nread ) ; } } finally { instr . close ( ) ; } }
Writes the content of a file to an OutputStream.
Writes the content of a file to an OutputStream .