public class TextWriter extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FILE_EXTENSION
Extension for txt-files.
|
protected Map<String,Object> |
filenames
For producing unique filenames.
|
static HandlerList<TextWriterWriterInterface<?>> |
writers
Hash map for supported classes in writer.
|
Constructor and Description |
---|
TextWriter() |
Modifier and Type | Method and Description |
---|---|
private String |
filenameFromLabel(String label)
Derive a file name from the cluster label.
|
protected String |
getFilename(Object result,
String filenamepre)
Try to find a unique file name.
|
void |
output(Database db,
Result r,
StreamFactory streamOpener)
Stream output.
|
private void |
printObject(TextWriterStream out,
Database db,
DBID objID,
List<Relation<?>> ra) |
protected void |
printSettings(TextWriterStream out,
List<SettingsResult> sr)
Writes a header providing information concerning the underlying database
and the specified parameter-settings.
|
private void |
writeClusterResult(Database db,
StreamFactory streamOpener,
Cluster<?> clus,
List<Relation<?>> ra,
NamingScheme naming,
List<SettingsResult> sr) |
private void |
writeIterableResult(StreamFactory streamOpener,
IterableResult<?> ri,
List<SettingsResult> sr) |
private void |
writeOrderingResult(Database db,
StreamFactory streamOpener,
OrderingResult or,
List<Relation<?>> ra,
List<SettingsResult> sr) |
private void |
writeOtherResult(StreamFactory streamOpener,
Result r,
List<SettingsResult> rs) |
public static final String FILE_EXTENSION
public static final HandlerList<TextWriterWriterInterface<?>> writers
protected String getFilename(Object result, String filenamepre)
result
- Result we printfilenamepre
- File name prefix to useprotected void printSettings(TextWriterStream out, List<SettingsResult> sr)
out
- the print stream where to writesr
- the settings to be written into the headerpublic void output(Database db, Result r, StreamFactory streamOpener) throws UnableToComplyException, IOException
db
- Database objectr
- Result classstreamOpener
- output stream managerUnableToComplyException
- when no usable results were foundIOException
- on IO errorprivate void printObject(TextWriterStream out, Database db, DBID objID, List<Relation<?>> ra) throws UnableToComplyException, IOException
UnableToComplyException
IOException
private void writeOtherResult(StreamFactory streamOpener, Result r, List<SettingsResult> rs) throws UnableToComplyException, IOException
UnableToComplyException
IOException
private void writeClusterResult(Database db, StreamFactory streamOpener, Cluster<?> clus, List<Relation<?>> ra, NamingScheme naming, List<SettingsResult> sr) throws FileNotFoundException, UnableToComplyException, IOException
private void writeIterableResult(StreamFactory streamOpener, IterableResult<?> ri, List<SettingsResult> sr) throws UnableToComplyException, IOException
UnableToComplyException
IOException
private void writeOrderingResult(Database db, StreamFactory streamOpener, OrderingResult or, List<Relation<?>> ra, List<SettingsResult> sr) throws IOException, UnableToComplyException
IOException
UnableToComplyException