public class ExternalSort extends Object
Constructor and Description |
---|
ExternalSort() |
Modifier and Type | Method and Description |
---|---|
static long |
estimateBestSizeOfBlocks(File filetobesorted,
int maxtmpfiles) |
static void |
main(String[] args) |
static int |
mergeSortedFiles(List<File> files,
File outputfile,
Comparator<String> cmp)
This merges a bunch of temporary flat files
|
static File |
sortAndSave(List<String> tmplist,
Comparator<String> cmp) |
static List<File> |
sortInBatch(File file,
Comparator<String> cmp)
This will simply load the file by blocks of x rows, then sort them in-memory, and write the
result to temporary files that have to be merged later.
|
static List<File> |
sortInBatch(File file,
Comparator<String> cmp,
int maxtmpfiles)
This will simply load the file by blocks of x rows, then sort them in-memory, and write the
result to temporary files that have to be merged later.
|
public static long estimateBestSizeOfBlocks(File filetobesorted, int maxtmpfiles)
public static List<File> sortInBatch(File file, Comparator<String> cmp) throws IOException
file
- some flat filecmp
- string comparatorIOException
- if an I/O problem occurs.public static List<File> sortInBatch(File file, Comparator<String> cmp, int maxtmpfiles) throws IOException
file
- some flat filecmp
- string comparatormaxtmpfiles
- maximum number of temporary filesIOException
- if an I/O problem occurs.public static File sortAndSave(List<String> tmplist, Comparator<String> cmp) throws IOException
IOException
public static int mergeSortedFiles(List<File> files, File outputfile, Comparator<String> cmp) throws IOException
files
- the files to merge.outputfile
- the target file.cmp
- the comprarator.IOException
- if an I/O problem occurs.public static void main(String[] args) throws IOException
IOException
Copyright © 2007–2018 Ubiquitous Knowledge Processing (UKP) Lab, Technische Universität Darmstadt. All rights reserved.