mirror of
https://github.com/apache/commons-csv.git
synced 2025-02-17 23:46:17 +00:00
Sort methods.
This commit is contained in:
parent
4f58df6d4a
commit
34262e8c5e
@ -748,6 +748,16 @@ public final class CSVFormat implements Serializable {
|
||||
return allowMissingColumnNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@ -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;
|
||||
@ -993,22 +993,6 @@ public final class CSVFormat implements Serializable {
|
||||
return new CSVPrinter(out, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@ -1031,26 +1015,6 @@ public final class CSVFormat implements Serializable {
|
||||
return new CSVPrinter(new OutputStreamWriter(new FileOutputStream(out), charset), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@ -1253,6 +1237,22 @@ public final class CSVFormat implements Serializable {
|
||||
out.append(quoteChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*
|
||||
@ -1445,6 +1445,21 @@ public final class CSVFormat implements Serializable {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@code CSVFormat} with the comment start marker of the format set to the specified character.
|
||||
*
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user