Example usage for org.apache.commons.vfs FileUtil writeContent

List of usage examples for org.apache.commons.vfs FileUtil writeContent

Introduction

In this page you can find the example usage for org.apache.commons.vfs FileUtil writeContent.

Prototype

public static void writeContent(final FileObject file, final OutputStream outstr) throws IOException 

Source Link

Document

Writes the content of a file to an OutputStream.

Usage

From source file:org.apache.commons.vfs.example.Shell.java

/**
 * Does a 'cat' command.//  w ww . j a  v  a 2s.c o m
 */
private void cat(final String[] cmd) throws Exception {
    if (cmd.length < 2) {
        throw new Exception("USAGE: cat <path>");
    }

    // Locate the file
    final FileObject file = mgr.resolveFile(cwd, cmd[1]);

    // Dump the contents to System.out
    FileUtil.writeContent(file, System.out);
    System.out.println();
}

From source file:org.jclouds.vfs.tools.blobstore.BlobStoreShell.java

/**
 * Does a 'cat' command./*from  w ww . j  a  v  a  2 s  .  c o m*/
 */
private void cat(final String[] cmd) throws Exception {
    if (cmd.length < 2) {
        throw new Exception("USAGE: cat <path>");
    }

    // Locate the file
    final FileObject file = remoteMgr.resolveFile(remoteCwd, cmd[1]);

    // Dump the contents to System.out
    FileUtil.writeContent(file, System.out);
    System.out.println();
}