ariba.util.io
Class FileSort

java.lang.Object
  extended by ariba.util.io.FileSort

public class FileSort
extends java.lang.Object

A utility to sort the contents of a file. The sorting is done in a resource-limited fashion and is suitable to sort large files. The resource limit is counting lines since the size of a string in bytes is not straightforward to determine.


Constructor Summary
FileSort()
           
 
Method Summary
static java.io.File sort(java.io.File source, java.io.File tempDirectory, java.lang.String encoding)
          Convenience method that sorts a file using the default resource limits (200K strings and 10 open file handles max) and the default string comparator
static java.io.File sort(java.io.File source, java.io.File tempDirectory, java.lang.String encoding, int maxLines, int maxHandles, java.util.Comparator<java.lang.String> comparator)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSort

public FileSort()
Method Detail

sort

public static java.io.File sort(java.io.File source,
                                java.io.File tempDirectory,
                                java.lang.String encoding)
                         throws java.io.IOException
Convenience method that sorts a file using the default resource limits (200K strings and 10 open file handles max) and the default string comparator

Parameters:
source - file object pointing to the source file. The source file will not be changed
tempDirectory - directory to store temporary files in. The resulting sorted file will be in this directory
encoding - encoding of the source file
Returns:
file object pointing to the sorted file
Throws:
java.io.IOException

sort

public static java.io.File sort(java.io.File source,
                                java.io.File tempDirectory,
                                java.lang.String encoding,
                                int maxLines,
                                int maxHandles,
                                java.util.Comparator<java.lang.String> comparator)
                         throws java.io.IOException
Parameters:
source - file object pointing to the source file. The source file will not be changed
tempDirectory - directory to store temporary files in. The resulting sorted file will be in this directory
encoding - encoding of the source file
maxLines - maximum number of lines concurrently in memory
maxHandles - maximum number of concurrently open file handles
comparator - string comparator to be used
Returns:
file object pointing to the sorted file
Throws:
java.io.IOException


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.