Code example for Formatter

Methods: format

0
     * @since 3.0 
     */ 
    public String toFormattedString()
    { 
        StringBuilder sb = new StringBuilder();
        Formatter fmt = new Formatter(sb);
        sb.append(formatType());
        sb.append(permissionToString(USER_ACCESS));
        sb.append(permissionToString(GROUP_ACCESS));
        sb.append(permissionToString(WORLD_ACCESS));
        fmt.format(" %4d", Integer.valueOf(getHardLinkCount()));
        fmt.format(" %-8s %-8s", getGroup(), getUser());
        fmt.format(" %8d", Long.valueOf(getSize()));
        Calendar timestamp = getTimestamp();
        if (timestamp != null) {
            fmt.format(" %1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS", timestamp);
            fmt.format(" %1$tZ", timestamp);
            sb.append(' ');
        } 
        sb.append(' ');
        sb.append(getName());
        return sb.toString();