private void showFile()

in commons-vfs2/src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java [104:140]


    private void showFile(final FileObject file, final String prefix) throws IOException {
        // Write details
        final 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()) {
                try (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 (final FileObject child : children) {
                    if (recursive) {
                        showFile(child, newPrefix);
                    } else {
                        log(newPrefix + child.getName().getBaseName());
                    }
                }
            }
        }
    }