core/src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java
/**
     * Logs the details of a file.
     */
Logs the details of a file.
Logs the details of a file .
private void showFile(final FileObject file, final String prefix) throws Exception
    {
        StringBuilder msg = new StringBuilder(prefix);
        msg.append(file.getName().getBaseName());
        if (file.exists())
        {
            msg.append(" (");
            msg.append(file.getType().getName());
            msg.append(")");
        }
        else
        {
            msg.append(" (unknown)");
        }
        log(msg.toString());
        if (file.exists())
        {
            final String newPrefix = prefix + INDENT;
            if (file.getType().hasContent())
            {
                final FileContent content = file.getContent();
                log(newPrefix + "Content-Length: " + content.getSize());
                log(newPrefix + "Last-Modified" + new Date(content.getLastModifiedTime()));
                if (showContent)
                {
                    log(newPrefix + "Content:");
                    logContent(file, newPrefix);
                }
            }
            if (file.getType().hasChildren())
            {
                final FileObject[] children = file.getChildren();
                for (int i = 0; i < children.length; i++)
                {
                    FileObject child = children[i];
                    if (recursive)
                    {
                        showFile(child, newPrefix);
                    }
                    else
                    {
                        log(newPrefix + child.getName().getBaseName());
                    }
                }
            }
        }
    }
private void showFile ( final FileObject file , final String prefix ) throws Exception { StringBuilder msg = new StringBuilder ( prefix ) ; msg . append ( file . getName ( ) . getBaseName ( ) ) ; if ( file . exists ( ) ) { msg . append ( " (" ) ; msg . append ( file . getType ( ) . getName ( ) ) ; msg . append ( ")" ) ; } else { msg . append ( " (unknown)" ) ; } log ( msg . toString ( ) ) ; if ( file . exists ( ) ) { final String newPrefix = prefix + INDENT ; if ( file . getType ( ) . hasContent ( ) ) { final FileContent content = file . getContent ( ) ; log ( newPrefix + "Content-Length: " + content . getSize ( ) ) ; log ( newPrefix + "Last-Modified" + new Date ( content . getLastModifiedTime ( ) ) ) ; if ( showContent ) { log ( newPrefix + "Content:" ) ; logContent ( file , newPrefix ) ; } } if ( file . getType ( ) . hasChildren ( ) ) { final FileObject [ ] children = file . getChildren ( ) ; for ( int i = 0 ; i < children . length ; i ++ ) { FileObject child = children [ i ] ; if ( recursive ) { showFile ( child , newPrefix ) ; } else { log ( newPrefix + child . getName ( ) . getBaseName ( ) ) ; } } } } }
Logs the details of a file.
Logs the details of a file .
// Write details