thinkmap.datasource.stream
Class StreamWriter

java.lang.Object
  extended by thinkmap.datasource.stream.StreamWriter
All Implemented Interfaces:
IEntityHandler
Direct Known Subclasses:
BinaryStreamWriter

public abstract class StreamWriter
extends Object
implements IEntityHandler

Superclass of all StreamWriters. Provides a common pattern of implementation.

Version:
$Revision: 1.2 $

Field Summary
protected  Exception error
           
protected  IStreamFactory factory
           
protected  IStreamFormat format
           
protected  OutputStream out
           
 
Fields inherited from interface thinkmap.datasource.IEntityHandler
ADD_REQUEST, ATTR_CACHE_REVISION, DELETE_REQUEST, EDGE, ENTITY_REQUEST, FLAG_NO_CACHE, FLAGS, FLAGS_DEFAULT, ID_REQUEST, LIST_ENTITIES_REQUEST, METADATA_REQUEST, NODE, NULL_REQUEST, QUERY_MAX_RESULTS, QUERY_STARTING_RESULT_NUMBER, QUERY_STRING, RELATED_REQUEST, RESERVED_ID_MAX, SINK, SOURCE, TOTAL_RESULTS, UNLIMITED_RESULTS, UPDATE_REQUEST
 
Constructor Summary
StreamWriter(IStreamFormat sf, IStreamFactory isf)
          Creates a new StreamWriter object.
 
Method Summary
protected abstract  void _beginMessage(int type)
           
protected abstract  void _endMessage()
           
 void beginMessage(int type)
          Begin a message.
 void endMessage()
          End a message.
 Exception getError()
          Get the error that occurred, if any.
 OutputStream getStream()
          Get the OutputStream this writes to.
 IStreamFactory getStreamFactory()
          Get the IStreamFactory.
 IStreamFormat getStreamFormat()
          Get the IStreamFormat.
protected  void setError(Exception e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface thinkmap.datasource.IEntityHandler
attribute, beginEntity, beginEntityMD, beginId, beginRelatedEntity, beginRelatedList, endEntity, endEntityMD, endId, endRelatedEntity, endRelatedList, error, fatalError, idKey, idKeyMD, property, propertyMD
 

Field Detail

out

protected OutputStream out

format

protected IStreamFormat format

factory

protected IStreamFactory factory

error

protected Exception error
Constructor Detail

StreamWriter

public StreamWriter(IStreamFormat sf,
                    IStreamFactory isf)
Creates a new StreamWriter object.

Parameters:
sf - IStreamFormat creating this
isf - IStreamFactory creating this
Method Detail

getStreamFormat

public IStreamFormat getStreamFormat()
Get the IStreamFormat.

Returns:
stream format

getStreamFactory

public IStreamFactory getStreamFactory()
Get the IStreamFactory.

Returns:
stream factory

getStream

public OutputStream getStream()
Get the OutputStream this writes to.

Returns:
output stream

getError

public Exception getError()
Get the error that occurred, if any.

Returns:
error

setError

protected void setError(Exception e)

beginMessage

public final void beginMessage(int type)
Description copied from interface: IEntityHandler
Begin a message.

Specified by:
beginMessage in interface IEntityHandler
Parameters:
type - one of the request types below, eg RELATED_REQUEST

endMessage

public final void endMessage()
Description copied from interface: IEntityHandler
End a message.

Specified by:
endMessage in interface IEntityHandler

_beginMessage

protected abstract void _beginMessage(int type)

_endMessage

protected abstract void _endMessage()


Copyright © 2013 Thinkmap, Inc. All Rights Reserved.