|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.model.source.parser.AbstractSourceCatalogWriter
public abstract class AbstractSourceCatalogWriter
A base class that implements the most common methods of the SourceCatalogWriter
Version Info:
$Revision: 714 $ |
$Date: 2007-06-13 10:36:05 -0600 (Wed, 13 Jun 2007) $ |
$Author: btruitt $ |
Field Summary | |
---|---|
protected List<edu.nrao.sss.model.source.parser.ParseError> |
errors
|
protected boolean |
writeWasSuccessful
|
Constructor Summary | |
---|---|
AbstractSourceCatalogWriter()
|
Method Summary | |
---|---|
String |
getError(int index)
Returns the index th error found during the most
recent write. |
int |
getErrorCount()
Returns the number of errors found during the most recent write. |
StringBuilder |
getErrors()
Returns the combined text of all errors found during the most recent write. |
boolean |
getSuccess()
Returns true if the most recently read data caused no parsing errors. |
protected void |
putError(int lineNum,
String message)
Adds a new error to our list. |
protected void |
putError(String message)
Adds a new error to our list. |
boolean |
write(SourceCatalog cat,
OutputStream out)
Delegates to write(SourceCatalog, OutputStream, FileCompressionFormat)
passing a format of UNCOMPRESSED |
boolean |
write(SourceCatalog cat,
OutputStream out,
FileCompressionFormat format)
Wraps the output stream in a ZipOutputStream or GZIPOutputStream
as appropriate depending on format . |
boolean |
write(SourceCatalog cat,
String fileName)
Delegates to write(SourceCatalog, Writer) . |
abstract boolean |
write(SourceCatalog cat,
Writer out)
Must be overridden to perform the actual writing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean writeWasSuccessful
protected List<edu.nrao.sss.model.source.parser.ParseError> errors
Constructor Detail |
---|
public AbstractSourceCatalogWriter()
Method Detail |
---|
public abstract boolean write(SourceCatalog cat, Writer out)
write
in interface SourceCatalogWriter
cat
- the catalog of sources to outputout
- the destination of the text representation.
NullPointerException
- if cat
is NULL.SourceCatalogWriter.write(SourceCatalog, Writer)
public boolean write(SourceCatalog cat, String fileName)
write(SourceCatalog, Writer)
.
write
in interface SourceCatalogWriter
cat
- the catalog of sources to outputfileName
- the name of a file.
SourceCatalogWriter.write(SourceCatalog, String)
public boolean write(SourceCatalog cat, OutputStream out)
write(SourceCatalog, OutputStream, FileCompressionFormat)
passing a format of UNCOMPRESSED
write
in interface SourceCatalogWriter
cat
- the catalog of sources to outputout
- the destination of the text representation.
SourceCatalogWriter.write(SourceCatalog, OutputStream)
public boolean write(SourceCatalog cat, OutputStream out, FileCompressionFormat format)
ZipOutputStream
or GZIPOutputStream
as appropriate depending on format
. If a ZipOutputStream is created,
a single ZipEntry is added to it with a name of XXX oops, this won't work
at all...What extension do I use?!
write
in interface SourceCatalogWriter
cat
- the source of sources that can be written out in a text format.out
- the OutputStream to which the sources should be written.format
- determines what kind of compression, if any, that should be used.
SourceCatalogWriter.getErrors()
public StringBuilder getErrors()
SourceCatalogWriter
Note that an "error" is anything unexpected encountered while writing. Not all errors are harmful. The text of each error includes the line number where it occurred and an explanation of what was wrong.
getErrors
in interface SourceCatalogWriter
SourceCatalogWriter.getErrors()
public String getError(int index)
SourceCatalogWriter
index
th error found during the most
recent write.
getError
in interface SourceCatalogWriter
index
- a positional value >= zero and < SourceCatalogWriter.getErrorCount()
.
index
th error found during the most
recent write.SourceCatalogWriter.getError(int)
public int getErrorCount()
SourceCatalogWriter
getErrorCount
in interface SourceCatalogWriter
SourceCatalogWriter.getErrorCount()
public boolean getSuccess()
SourceCatalogWriter
SourceCatalog
created
by this reader may be perfectly fine even if this method
returns false.
getSuccess
in interface SourceCatalogWriter
SourceCatalogWriter.getSuccess()
protected void putError(String message)
protected void putError(int lineNum, String message)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |