Marshaller is the type of basic types marshallers. They should be used
by protocols.
close
public void close()
This method causes the message to lose all its references to the underlying
chunks, and
release
each
of them. It also released the context.
getContext
public Context getContext()
Returns a Context
associated with this marshaller.
- a
Context
associated with this marshaller.
getOffset
public int getOffset()
Returns the current offset in the message, i.e., the position in the message
at which the next byte will be written.
- the current offset in the message.
getState
public Chunk getState()
Returns the state of the message as a (chain of) chunk(s).
The returned chunk(s) are NOT duplicated. If the caller keeps a
reference to them, it must
reset
the message, and not
continue to use it.
- the state of the message as a (chain of) chunk(s).
isLittleEndian
public boolean isLittleEndian()
Returns true if this marshaller is little-endian, false otherwise.
- true if this marshaller is little-endian, false otherwise.
outputStream
public OutputStream outputStream()
Returns an output stream to write into the message. Closing the output stream
has the same effect as closing the marshaller itself.
- an output stream to write into the message.
reset
public void reset()
This method causes the message to lose all its references to the underlying
chunks, without
releasing
them. This method must not be used if no reference to chunks present in the
message is held by an entity in charge of their release. It also releases
the context associated with the target marshaller.
sameContents
public boolean sameContents(Marshaller marshaller)
Checks if the target marshaller and the provided one have the same contents,
i.e., they contain the same bits.
marshaller
- a marshaller;
- true if the target marshaller and the provided one have the same
contents, false otherwise.
setOffset
public void setOffset(int offset)
Sets the offset in the message.
This method may be used to override data already written into the message.
offset
- the new offset.
write
public void write(Chunk chunk)
Writes a chunk in the message.
The target becomes the "owner" of the provided chunk, and therefore is not
supposed to duplicate it. If the entity invoking this operation wants to keep
a reference to the chunk, it must be duplicated.
chunk
- the chunk to be written.
writeBoolean
public void writeBoolean(boolean b)
throws JonathanException
Writes a boolean.
b
- a boolean;
writeByte
public void writeByte(byte b)
throws JonathanException
Writes a byte.
b
- a byte;
writeByteArray
public void writeByteArray(byte[] array,
int offset,
int length)
throws JonathanException
Writes an array of bytes.
array
- an array of bytes;
writeChar16
public void writeChar16(char i)
throws JonathanException
Writes a 16 bits char.
i
- a char;
writeChar8
public void writeChar8(char i)
throws JonathanException
Writes an 8 bits char.
The method used to translate the provided
char
into an 8 bits
entity is not specified.
i
- a char;
writeDouble
public void writeDouble(double d)
throws JonathanException
Writes a double.
d
- a double;
writeFloat
public void writeFloat(float f)
throws JonathanException
Writes a float.
f
- a float;
writeInt
public void writeInt(int i)
throws JonathanException
Writes an int.
i
- an int;
writeLong
public void writeLong(long i)
throws JonathanException
Writes a long.
i
- a long;
writeReference
public void writeReference(Object obj)
throws JonathanException
Writes an object reference in the marshaller.
obj
- an object reference
writeShort
public void writeShort(short i)
throws JonathanException
Writes a short.
i
- a short;
writeString16
public void writeString16(String s)
throws JonathanException
Writes a string of 16 bits chars.
s
- a string;
writeString8
public void writeString8(String s)
throws JonathanException
Writes a string of 8 bits chars.
s
- a string;
writeValue
public void writeValue(Object obj)
throws JonathanException
Writes a value in the marshaller.
obj
- an object
- 3.0 a2