public abstract class SampleTextFile
extends java.lang.Object
Copies one text file to another with a selection criterion.
Subclasses must implement the setupSampling, lineSelected, and samplingDone methods.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
inputFileName
Input file name.
|
protected java.lang.String |
outputFileName
Output file name.
|
protected double |
sample
Sample count, percentage, etc.
|
| Constructor and Description |
|---|
SampleTextFile(java.lang.String inputFileName,
java.lang.String outputFileName,
double sample)
Copy a text file to another while sampling the input lines.
|
SampleTextFile(java.lang.String inputFileName,
java.lang.String outputFileName,
int sample)
Copy a text file to another while sampling the input lines.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract boolean |
lineSelected(java.lang.String inputLine)
Check if line should be selected.
|
void |
sample()
Perform the sampling.
|
boolean |
samplingDone()
Determine if sampling done.
|
protected void |
setupSampling()
Set up the sampling.
|
protected java.lang.String inputFileName
protected java.lang.String outputFileName
protected double sample
public SampleTextFile(java.lang.String inputFileName,
java.lang.String outputFileName,
double sample)
inputFileName - Input file name.outputFileName - Output file name.sample - Sample count, percentage, etc.public SampleTextFile(java.lang.String inputFileName,
java.lang.String outputFileName,
int sample)
inputFileName - Input file name.outputFileName - Output file name.sample - Sample count, percentage, etc.protected void setupSampling()
public void sample()
protected abstract boolean lineSelected(java.lang.String inputLine)
inputLine - The input line.Subclasses must override this method.
public boolean samplingDone()