biz.c24.io.api.presentation
Class SwiftSource

java.lang.Object
  extended by biz.c24.io.api.presentation.Source
      extended by biz.c24.io.api.presentation.SwiftSource
All Implemented Interfaces:
Serializable, Cloneable

public class SwiftSource
extends Source

Created by IntelliJ IDEA. User: divanmostert Date: 14/11/2011 Time: 14:16

See Also:
Serialized Form

Constructor Summary
SwiftSource()
          Constructs a new instance.
SwiftSource(InputStream stream)
          Constructs a new instance which will read from stream.
SwiftSource(Reader reader)
          Constructs a new instance which will read from reader.
SwiftSource(SwiftSource clone)
          Constructs a new instance cloned from clone.
 
Method Summary
 Object clone()
           
 BorderedCharDataReader getBuffer()
           
 int getLookAhead()
          Returns the maximum number of characters to look ahead.
 int getLookBehind()
          Returns the maximum number of characters to look behind.
 InputStream getMarkableInputStream()
           
 boolean isEndOfDataRequired()
          Returns whether the stream / reader must be emptied for the read to succeed.
 void readObject(ComplexDataObject object)
          Reads an object from the the reader or input stream that has been set (optional operation).
 ComplexDataObject readObject(Element element)
          Reads an object from the the reader or input stream that has been set.
 boolean ready()
          Tests whether the underlying stream or reader contains more data waiting to be parsed.
 void setEndOfDataRequired(boolean endOfDataRequired)
          Sets whether the stream / reader must be emptied for the read to succeed.
 void setInputStream(InputStream stream, URI systemId)
          Sets the input stream and system ID (optional operation).
 void setLookAhead(int lookAhead)
          Sets the maximum number of characters to look ahead.
 void setLookBehind(int lookBehind)
          Sets the maximum number of characters to look behind.
 void setReader(Reader reader, URI systemId)
          Sets the reader (optional operation).
 
Methods inherited from class biz.c24.io.api.presentation.Source
checkInit, getEncoding, getInputStream, getParseListener, getReader, getSystemId, reader, setEncoding, setInputStream, setParseListener, setReader, setSystemId, stream
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwiftSource

public SwiftSource()
Constructs a new instance.


SwiftSource

public SwiftSource(SwiftSource clone)
Constructs a new instance cloned from clone.

Parameters:
clone - The instance to clone.

SwiftSource

public SwiftSource(Reader reader)
Constructs a new instance which will read from reader.

Parameters:
reader - The reader to read the data from.

SwiftSource

public SwiftSource(InputStream stream)
Constructs a new instance which will read from stream.

Parameters:
stream - The stream to read the data from.
Method Detail

ready

public boolean ready()
Description copied from class: Source
Tests whether the underlying stream or reader contains more data waiting to be parsed.
This method should be called in preference to Reader.ready() and InputStream.available() since it may need to take into account data which has been buffered by the Source implementation.

Overrides:
ready in class Source
Returns:
Whether there is unparsed data available.

getLookAhead

public int getLookAhead()
Returns the maximum number of characters to look ahead. This parameter controls the maximum buffer size beyond the current offset.

Returns:
The look ahead value.

setLookAhead

public void setLookAhead(int lookAhead)
Sets the maximum number of characters to look ahead.

Parameters:
lookAhead - The new look ahead value.

getLookBehind

public int getLookBehind()
Returns the maximum number of characters to look behind. This paraemter controls the maximum buffer size upto the current offset.

Returns:
The look behind value.

setLookBehind

public void setLookBehind(int lookBehind)
Sets the maximum number of characters to look behind.

Parameters:
lookBehind - The new look behind value.

isEndOfDataRequired

public boolean isEndOfDataRequired()
Returns whether the stream / reader must be emptied for the read to succeed.

Returns:
Whether an end of data marker is required in the stream / reader.

setEndOfDataRequired

public void setEndOfDataRequired(boolean endOfDataRequired)
Sets whether the stream / reader must be emptied for the read to succeed. This parameter should be set to false if the readObject method is to be called more than once on the same stream / reader or if the calling code is not concerend about additional data such as blank lines. Set this parameter to true (the default) if you are expecting the stream / reader to contain one and only one data instance.

Parameters:
endOfDataRequired - Whether an end of data marker is required in the stream / reader.

setReader

public void setReader(Reader reader,
                      URI systemId)
Description copied from class: Source
Sets the reader (optional operation).

Overrides:
setReader in class Source
Parameters:
reader - The new value.
systemId - The system ID identifying the reader.

setInputStream

public void setInputStream(InputStream stream,
                           URI systemId)
Description copied from class: Source
Sets the input stream and system ID (optional operation).

Overrides:
setInputStream in class Source
Parameters:
stream - The new value.
systemId - The system ID identifying the stream.

readObject

public ComplexDataObject readObject(Element element)
                             throws IOException
Description copied from class: Source
Reads an object from the the reader or input stream that has been set.

Specified by:
readObject in class Source
Parameters:
element - The element declaration to which the input data is expected to adhere.
Returns:
The newly created object.
Throws:
IOException - If the complete object could not be read for any reason.

readObject

public void readObject(ComplexDataObject object)
                throws IOException
Description copied from class: Source
Reads an object from the the reader or input stream that has been set (optional operation).

Specified by:
readObject in class Source
Parameters:
object - The object into which the input data should be parsed.
Throws:
IOException - If the complete object could not be read for any reason.

clone

public Object clone()
Specified by:
clone in class Source

getMarkableInputStream

public InputStream getMarkableInputStream()
Overrides:
getMarkableInputStream in class Source

getBuffer

public BorderedCharDataReader getBuffer()


C24 Technologies © 2002-2012: All Rights Reserved.