You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by st...@apache.org on 2018/02/09 14:21:55 UTC

[30/34] commons-csv git commit: Sort methods.

Sort methods.

Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/34262e8c
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/34262e8c
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/34262e8c

Branch: refs/heads/CSV-216
Commit: 34262e8c5e0d6746b914468d9e8f739b9f3cfa13
Parents: 4f58df6
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Dec 11 11:49:36 2017 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Dec 11 11:49:36 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/commons/csv/CSVFormat.java  | 122 +++++++++----------
 1 file changed, 61 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-csv/blob/34262e8c/src/main/java/org/apache/commons/csv/CSVFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index dc7588b..9e6c807 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -749,6 +749,16 @@ public final class CSVFormat implements Serializable {
     }
 
     /**
+     * Returns whether to flush on close.
+     *
+     * @return whether to flush on close.
+     * @since 1.6
+     */
+    public boolean getAutoFlush() {
+        return autoFlush;
+    }
+
+    /**
      * Returns the character marking the start of a line comment.
      *
      * @return the comment start marker, may be {@code null}
@@ -891,16 +901,6 @@ public final class CSVFormat implements Serializable {
         return trim;
     }
 
-    /**
-     * Returns whether to flush on close.
-     *
-     * @return whether to flush on close.
-     * @since 1.6
-     */
-    public boolean getAutoFlush() {
-        return autoFlush;
-    }
-
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -994,22 +994,6 @@ public final class CSVFormat implements Serializable {
     }
 
     /**
-     * Prints to the {@link System#out}.
-     *
-     * <p>
-     * See also {@link CSVPrinter}.
-     * </p>
-     *
-     * @return a printer to {@link System#out}.
-     * @throws IOException
-     *             thrown if the optional header cannot be printed.
-     * @since 1.5
-     */
-    public CSVPrinter printer() throws IOException {
-        return new CSVPrinter(System.out, this);
-    }
-
-    /**
      * Prints to the specified output.
      *
      * <p>
@@ -1032,26 +1016,6 @@ public final class CSVFormat implements Serializable {
     }
 
     /**
-     * Prints to the specified output.
-     *
-     * <p>
-     * See also {@link CSVPrinter}.
-     * </p>
-     *
-     * @param out
-     *            the output.
-     * @param charset
-     *            A charset.
-     * @return a printer to an output.
-     * @throws IOException
-     *             thrown if the optional header cannot be printed.
-     * @since 1.5
-     */
-    public CSVPrinter print(final Path out, final Charset charset) throws IOException {
-        return print(Files.newBufferedWriter(out, charset));
-    }
-
-    /**
      * Prints the {@code value} as the next value on the line to {@code out}. The value will be escaped or encapsulated
      * as needed. Useful when one wants to avoid creating CSVPrinters.
      *
@@ -1104,6 +1068,26 @@ public final class CSVFormat implements Serializable {
         }
     }
 
+    /**
+     * Prints to the specified output.
+     *
+     * <p>
+     * See also {@link CSVPrinter}.
+     * </p>
+     *
+     * @param out
+     *            the output.
+     * @param charset
+     *            A charset.
+     * @return a printer to an output.
+     * @throws IOException
+     *             thrown if the optional header cannot be printed.
+     * @since 1.5
+     */
+    public CSVPrinter print(final Path out, final Charset charset) throws IOException {
+        return print(Files.newBufferedWriter(out, charset));
+    }
+
     /*
      * Note: must only be called if escaping is enabled, otherwise will generate NPE
      */
@@ -1254,6 +1238,22 @@ public final class CSVFormat implements Serializable {
     }
 
     /**
+     * Prints to the {@link System#out}.
+     *
+     * <p>
+     * See also {@link CSVPrinter}.
+     * </p>
+     *
+     * @return a printer to {@link System#out}.
+     * @throws IOException
+     *             thrown if the optional header cannot be printed.
+     * @since 1.5
+     */
+    public CSVPrinter printer() throws IOException {
+        return new CSVPrinter(System.out, this);
+    }
+
+    /**
      * Outputs the trailing delimiter (if set) followed by the record separator (if set).
      *
      * @param out
@@ -1446,6 +1446,21 @@ public final class CSVFormat implements Serializable {
     }
 
     /**
+     * Returns a new {@code CSVFormat} with whether to flush on close.
+     *
+     * @param autoFlush
+     *            whether to flush on close.
+     *
+     * @return A new CSVFormat that is equal to this but with the specified autoFlush setting.
+     * @since 1.6
+     */
+    public CSVFormat withAutoFlush(final boolean autoFlush) {
+        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
+            ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
+            skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
+    }
+
+    /**
      * Returns a new {@code CSVFormat} with the comment start marker of the format set to the specified character.
      *
      * Note that the comment start character is only recognized at the start of a line.
@@ -1959,19 +1974,4 @@ public final class CSVFormat implements Serializable {
                 ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
                 skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
     }
-
-    /**
-     * Returns a new {@code CSVFormat} with whether to flush on close.
-     *
-     * @param autoFlush
-     *            whether to flush on close.
-     *
-     * @return A new CSVFormat that is equal to this but with the specified autoFlush setting.
-     * @since 1.6
-     */
-    public CSVFormat withAutoFlush(final boolean autoFlush) {
-        return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
-            ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
-            skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase, trim, trailingDelimiter, autoFlush);
-    }
 }