public final class FileIOUtils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FileIOUtils.BurnOnCloseFileIterator<T>
Deprecated.
use
BurnOnCloseFileIterator instead |
static class |
FileIOUtils.FileLineDifferenceIterator
Deprecated.
use
FileLineDifferenceIterator instead |
static class |
FileIOUtils.TransformingComparator
Decorates the given comparator and applies the function before delegating to the decorated
comparator.
|
| Modifier and Type | Field and Description |
|---|---|
static java.util.Comparator<java.lang.String> |
lexComparator |
static com.google.common.base.Function<java.lang.String,java.lang.String> |
passThruTransformer
Deprecated.
use
Function.identity() instead |
| Modifier and Type | Method and Description |
|---|---|
static void |
append(java.util.List<java.io.File> files,
java.io.File appendTo,
boolean delete)
Appends the contents of the list of files to the given file and deletes the files
if the delete flag is enabled.
|
static java.io.File |
copy(java.io.InputStream stream)
Copies an input stream to a file.
|
static void |
copyInputStreamToFile(java.io.InputStream source,
java.io.File destination)
Copy the input stream to the given file.
|
static java.util.Comparator<java.lang.String> |
lineBreakAwareComparator(java.util.Comparator<java.lang.String> delegate)
Composing iterator which unescapes for line breaks and delegates to the given comparator.
|
static void |
merge(java.util.List<java.io.File> files,
java.io.File output)
Merges a list of files after sorting with the
lexComparator. |
static void |
merge(java.util.List<java.io.File> files,
java.io.File output,
java.util.Comparator<java.lang.String> comparator)
Merges a list of files after sorting with the given comparator.
|
static java.util.Set<java.lang.String> |
readStringsAsSet(java.io.InputStream stream,
boolean unescape)
Reads strings from the given stream into a set and optionally unescaping for line breaks.
|
static void |
sort(java.io.File file)
Sorts the given file externally using the
lexComparator and removes duplicates. |
static void |
sort(java.io.File file,
java.util.Comparator<java.lang.String> comparator)
Sorts the given file externally with the given comparator and removes duplicates.
|
static void |
writeAsLine(java.io.BufferedWriter writer,
java.lang.String str,
boolean escape)
Writes a string as a new line into the given buffered writer and optionally
escapes the line for line breaks.
|
static int |
writeStrings(java.util.Iterator<java.lang.String> iterator,
java.io.File f,
boolean escape)
Writes string from the given iterator to the given file and optionally
escape the written strings for line breaks.
|
static int |
writeStrings(java.util.Iterator<java.lang.String> iterator,
java.io.File f,
boolean escape,
java.util.function.Function<java.lang.String,java.lang.String> transformer,
@Nullable Logger logger,
@Nullable java.lang.String message)
Writes string from the given iterator to the given file and optionally
escape the written strings for line breaks.
|
static int |
writeStrings(java.util.Iterator<java.lang.String> iterator,
java.io.File f,
boolean escape,
@NotNull com.google.common.base.Function<java.lang.String,java.lang.String> transformer,
@Nullable Logger logger,
@Nullable java.lang.String message)
Deprecated.
|
static int |
writeStrings(java.util.Iterator<java.lang.String> iterator,
java.io.File f,
boolean escape,
@Nullable Logger logger,
@Nullable java.lang.String message)
Writes string from the given iterator to the given file and optionally
escape the written strings for line breaks.
|
public static final java.util.Comparator<java.lang.String> lexComparator
@Deprecated public static final com.google.common.base.Function<java.lang.String,java.lang.String> passThruTransformer
Function.identity() insteadpublic static void sort(java.io.File file)
throws java.io.IOException
lexComparator and removes duplicates.file - file whose contents needs to be sortedjava.io.IOExceptionpublic static void sort(java.io.File file,
java.util.Comparator<java.lang.String> comparator)
throws java.io.IOException
file - file whose contents needs to be sortedcomparator - to comparejava.io.IOExceptionpublic static void merge(java.util.List<java.io.File> files,
java.io.File output)
throws java.io.IOException
lexComparator.files - files to mergeoutput - merge output filejava.io.IOExceptionpublic static void merge(java.util.List<java.io.File> files,
java.io.File output,
java.util.Comparator<java.lang.String> comparator)
throws java.io.IOException
files - files to mergeoutput - merge output filejava.io.IOExceptionpublic static java.io.File copy(java.io.InputStream stream)
throws java.io.IOException
stream - steam to copyjava.io.IOExceptionpublic static void append(java.util.List<java.io.File> files,
java.io.File appendTo,
boolean delete)
throws java.io.IOException
writeAsLine(BufferedWriter, String, boolean)
with true to escape line break characters.files - appendTo - java.io.IOExceptionpublic static void writeAsLine(java.io.BufferedWriter writer,
java.lang.String str,
boolean escape)
throws java.io.IOException
writer - to write the stringstr - the string to writeescape - whether to escape string for line breaksjava.io.IOExceptionpublic static int writeStrings(java.util.Iterator<java.lang.String> iterator,
java.io.File f,
boolean escape)
throws java.io.IOException
iterator - the source of the stringsf - file to write toescape - whether to escape for line breaksjava.io.IOExceptionpublic static int writeStrings(java.util.Iterator<java.lang.String> iterator,
java.io.File f,
boolean escape,
@Nullable
@Nullable Logger logger,
@Nullable
@Nullable java.lang.String message)
throws java.io.IOException
iterator - the source of the stringsf - file to write toescape - escape whether to escape for line breakslogger - logger to log progressmessage - message to logjava.io.IOExceptionpublic static int writeStrings(java.util.Iterator<java.lang.String> iterator,
java.io.File f,
boolean escape,
@NotNull
java.util.function.Function<java.lang.String,java.lang.String> transformer,
@Nullable
@Nullable Logger logger,
@Nullable
@Nullable java.lang.String message)
throws java.io.IOException
iterator - the source of the stringsf - file to write toescape - escape whether to escape for line breakstransformer - any transformation on the inputlogger - logger to log progressmessage - message to logjava.io.IOException@Deprecated
public static int writeStrings(java.util.Iterator<java.lang.String> iterator,
java.io.File f,
boolean escape,
@NotNull
@NotNull com.google.common.base.Function<java.lang.String,java.lang.String> transformer,
@Nullable
@Nullable Logger logger,
@Nullable
@Nullable java.lang.String message)
throws java.io.IOException
writeStrings(Iterator, File, boolean, java.util.function.Function, Logger, String) insteadjava.io.IOExceptionpublic static java.util.Set<java.lang.String> readStringsAsSet(java.io.InputStream stream,
boolean unescape)
throws java.io.IOException
stream - the source of the stringsunescape - whether to unescape for line breaksjava.io.IOExceptionpublic static java.util.Comparator<java.lang.String> lineBreakAwareComparator(java.util.Comparator<java.lang.String> delegate)
delegate - the actual comparison iteratorpublic static void copyInputStreamToFile(java.io.InputStream source,
java.io.File destination)
throws java.io.IOException
source - the input stream sourcedestination - the file to write tojava.io.IOExceptionCopyright © 2010 - 2023 Adobe. All Rights Reserved