|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.FudgeDataOutputStreamWriter
public class FudgeDataOutputStreamWriter
Implementation of a FudgeStreamWriter
that writes to a DataOutput
.
Constructor Summary | |
---|---|
FudgeDataOutputStreamWriter(FudgeContext fudgeContext,
DataOutput dataOutput)
Creates a new FudgeDataOutputStreamWriter associated with the given FudgeContext and DataOutput target. |
|
FudgeDataOutputStreamWriter(FudgeContext fudgeContext,
OutputStream outputStream)
Creates a new FudgeDataOutputStreamWriter by wrapping a OutputStream with a DataOutput . |
Method Summary | |
---|---|
void |
close()
Flushes and closes this writer and the underlying target. |
void |
envelopeComplete()
No data is written - the end of the envelope is implied by the size from the header. |
void |
flush()
Flushes any data from the internal buffers to the target stream and attempts to flush the underlying stream if appropriate. |
FudgeTaxonomy |
getCurrentTaxonomy()
Returns the taxonomy (if any) that is currently being used to encode fields. |
int |
getCurrentTaxonomyId()
Returns the current taxonomy identifier. |
protected DataOutput |
getDataOutput()
|
FudgeContext |
getFudgeContext()
Returns the bound FudgeContext used for type and taxonomy resolution. |
boolean |
isFlushOnEnvelopeComplete()
Indicates if flush() is to be called on envelope completion. |
void |
setCurrentTaxonomyId(int taxonomyId)
Sets the current taxonomy, by identifier, to be used to encode fields. |
void |
setFlushOnEnvelopeComplete(boolean automaticFlush)
Set whether to call flush() on envelope completion. |
String |
toString()
|
void |
writeEnvelopeHeader(int processingDirectives,
int schemaVersion,
int messageSize)
Writes a message envelope header. |
void |
writeField(FudgeField field)
Writes a message field. |
void |
writeField(Short ordinal,
String name,
FudgeFieldType type,
Object fieldValue)
Writes a message field. |
void |
writeFields(FudgeFieldContainer msg)
Writes a set of fields. |
protected void |
writeFieldValue(FudgeFieldType type,
Object value,
int valueSize)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FudgeDataOutputStreamWriter(FudgeContext fudgeContext, DataOutput dataOutput)
FudgeDataOutputStreamWriter
associated with the given FudgeContext
and DataOutput
target.
The Fudge context is used to hold all encoding parameters such as taxonomy and type resolution.
fudgeContext
- the FudgeContext
to associate withdataOutput
- the target to write Fudge elements topublic FudgeDataOutputStreamWriter(FudgeContext fudgeContext, OutputStream outputStream)
FudgeDataOutputStreamWriter
by wrapping a OutputStream
with a DataOutput
.
fudgeContext
- the FudgeContext
to associate withoutputStream
- the target to write Fudge elements toMethod Detail |
---|
public void close()
close
in interface Closeable
close
in interface FudgeStreamWriter
public void flush()
flush
in interface Flushable
flush
in interface FudgeStreamWriter
public FudgeContext getFudgeContext()
FudgeContext
used for type and taxonomy resolution.
getFudgeContext
in interface FudgeStreamWriter
FudgeContext
protected DataOutput getDataOutput()
public FudgeTaxonomy getCurrentTaxonomy()
null
if no taxonomy is specified or the taxonomy identifier cannot be resolved by the bound FudgeContext
.
getCurrentTaxonomy
in interface FudgeStreamWriter
FudgeTaxonomy
public void setCurrentTaxonomyId(int taxonomyId)
setCurrentTaxonomyId
in interface FudgeStreamWriter
taxonomyId
- the taxonomy identifierpublic int getCurrentTaxonomyId()
getCurrentTaxonomyId
in interface FudgeStreamWriter
public void writeEnvelopeHeader(int processingDirectives, int schemaVersion, int messageSize)
writeEnvelopeHeader
in interface FudgeStreamWriter
processingDirectives
- the processing directive flagsschemaVersion
- the schema version valuemessageSize
- the Fudge encoded size of the underlying message, including the message envelopepublic void envelopeComplete()
flush()
will be called to flush
the underlying stream if possible.
envelopeComplete
in interface FudgeStreamWriter
public boolean isFlushOnEnvelopeComplete()
flush()
is to be called on envelope completion.
true
if flush
is to be called, false
otherwisepublic void setFlushOnEnvelopeComplete(boolean automaticFlush)
flush()
on envelope completion. The default behavior is to do so.
automaticFlush
- true
to call flush
on envelope completion, false
otherwisepublic void writeFields(FudgeFieldContainer msg)
writeFields
in interface FudgeStreamWriter
msg
- the fields to write.public void writeField(FudgeField field)
writeField
in interface FudgeStreamWriter
field
- the message field to writepublic void writeField(Short ordinal, String name, FudgeFieldType type, Object fieldValue)
writeField
in interface FudgeStreamWriter
ordinal
- the ordinal index of the field, or null
to omit.name
- the name of the field, null
to omit. If the ordinal is omitted and the name matches an entry in the current taxonomy the name will be replaced by the taxonomy resolved ordinal.type
- the type of the underlying datafieldValue
- value of the fieldprotected void writeFieldValue(FudgeFieldType type, Object value, int valueSize)
type
- the FudgeFieldType
defining how to write thisvalue
- the value to writevalueSize
- the size of the valuepublic String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |