protected void sort()

in gshell-commands/gshell-text/src/main/java/org/apache/geronimo/gshell/commands/text/SortAction.java [110:126]


    protected void sort(InputStream input, PrintWriter out) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(input));
        List<String> strings = new ArrayList<String>();
        for (String s = r.readLine(); s != null; s = r.readLine()) {
            strings.add(s);
        }
        char sep = (separator == null || separator.length() == 0) ? '\0' : separator.charAt(0);
        Collections.sort(strings, new SortComparator(caseInsensitive, reverse, ignoreBlanks, numeric, sep, sortFields));
        String last = null;
        for (String s : strings) {
            if (last == null) {
                last = s;
            } else if (!unique || !s.equals(last)) {
                out.println(s);
            }
        }
    }