public abstract class AbstractStartStringSingleFactory extends AbstractSingleReaderWriterFactory implements SingleReaderWriterFactory
checkFormat()
methods by testing of the read content
start with a certain string, determined by getExpectedStart()
.Constructor and Description |
---|
AbstractStartStringSingleFactory(java.lang.String expectedStart)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkFormat(java.io.Reader reader,
ReadWriteParameterMap parameters)
Implementations should read the start of the characters returned by the reader here and determine whether
the content could be valid according to the target format.
|
protected java.lang.String |
getExpectedStart() |
checkFormat, createFormatInfo, getFormatInfo
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkFormat, getFormatInfo, getReader, getReader, getWriter, hasReader, hasWriter
public AbstractStartStringSingleFactory(java.lang.String expectedStart)
expectedStart
- the start of the content to be expected if it is valid for the target formatprotected java.lang.String getExpectedStart()
public boolean checkFormat(java.io.Reader reader, ReadWriteParameterMap parameters) throws java.io.IOException
SingleReaderWriterFactory
checkFormat
in interface SingleReaderWriterFactory
reader
- the reader to read the first bytes fromparameters
- the parameters map that would also be used to create a readertrue
if the tested reader may return content in target format or false
if the content is not
in valid target formatjava.io.IOException