public abstract class AbstractDataWriter
extends java.lang.Object
implements ej.data.DataWriter
DataWriter
interface with the following features:
DataWriter
interface (an IllegalStateException
thrown on error).0
(e.g writeBoolean
calls writeBoolean0
). Methods can throw any kind of exceptions that will be wrapped into an IOException
.end()
method is called when the data is terminated. This method calls the Flushable.flush()
of the Flushable
given to the constructor.Modifier and Type | Field and Description |
---|---|
protected java.io.Flushable |
flushable
Flushable flushed when the end of the data has been written. |
protected ej.data.DataStreamState |
state |
Constructor and Description |
---|
AbstractDataWriter() |
AbstractDataWriter(java.io.Flushable flushable)
Creates a new
AbstractDataWriter that will use the given Flushable to notify the end of the data. |
Modifier and Type | Method and Description |
---|---|
protected void |
end()
This method is called when the data has been fully written, giving
a "finalization" hook to the implementation.
|
void |
writeArrayValueEnd() |
protected abstract void |
writeArrayValueEnd0() |
void |
writeArrayValueStart() |
protected abstract void |
writeArrayValueStart0() |
void |
writeBooleanValue(boolean value) |
protected abstract void |
writeBooleanValue0(boolean value) |
void |
writeDoubleValue(double value) |
protected abstract void |
writeDoubleValue0(double value) |
void |
writeIntKey(int key) |
protected abstract void |
writeIntKey0(int value) |
void |
writeIntValue(int value) |
protected abstract void |
writeIntValue0(int value) |
void |
writeLongValue(long value) |
protected abstract void |
writeLongValue0(long value) |
void |
writeMapValueEnd() |
protected abstract void |
writeMapValueEnd0() |
void |
writeMapValueStart() |
protected abstract void |
writeMapValueStart0() |
void |
writeStringKey(java.lang.String key) |
protected abstract void |
writeStringKey0(java.lang.String value) |
void |
writeStringValue(java.lang.String value) |
protected abstract void |
writeStringValue0(java.lang.String value) |
protected final ej.data.DataStreamState state
protected final java.io.Flushable flushable
Flushable
flushed when the end of the data has been written. May be null.public AbstractDataWriter(java.io.Flushable flushable)
AbstractDataWriter
that will use the given Flushable
to notify the end of the data.
The Flushable.flush()
method of the Flushable
is called when end of the data is reached.flushable
- the Flushable
used to flush. May be null.public AbstractDataWriter()
public final void writeBooleanValue(boolean value) throws java.io.IOException
writeBooleanValue
in interface ej.data.DataWriter
java.io.IOException
public final void writeIntValue(int value) throws java.io.IOException
writeIntValue
in interface ej.data.DataWriter
java.io.IOException
public final void writeLongValue(long value) throws java.io.IOException
writeLongValue
in interface ej.data.DataWriter
java.io.IOException
public final void writeDoubleValue(double value) throws java.io.IOException
writeDoubleValue
in interface ej.data.DataWriter
java.io.IOException
public final void writeStringValue(java.lang.String value) throws java.io.IOException
writeStringValue
in interface ej.data.DataWriter
java.io.IOException
public final void writeStringKey(java.lang.String key) throws java.io.IOException
writeStringKey
in interface ej.data.DataWriter
java.io.IOException
public final void writeIntKey(int key) throws java.io.IOException
writeIntKey
in interface ej.data.DataWriter
java.io.IOException
public final void writeArrayValueStart() throws java.io.IOException
writeArrayValueStart
in interface ej.data.DataWriter
java.io.IOException
public final void writeArrayValueEnd() throws java.io.IOException
writeArrayValueEnd
in interface ej.data.DataWriter
java.io.IOException
public final void writeMapValueStart() throws java.io.IOException
writeMapValueStart
in interface ej.data.DataWriter
java.io.IOException
public final void writeMapValueEnd() throws java.io.IOException
writeMapValueEnd
in interface ej.data.DataWriter
java.io.IOException
protected void end() throws java.io.IOException
Flushable.flush()
method of the Flushable
given
to the constructor.java.io.IOException
- on I/O error.protected abstract void writeBooleanValue0(boolean value) throws java.lang.Throwable
java.lang.Throwable
protected abstract void writeIntValue0(int value) throws java.lang.Throwable
java.lang.Throwable
protected abstract void writeLongValue0(long value) throws java.lang.Throwable
java.lang.Throwable
protected abstract void writeDoubleValue0(double value) throws java.lang.Throwable
java.lang.Throwable
protected abstract void writeStringValue0(java.lang.String value) throws java.lang.Throwable
java.lang.Throwable
protected abstract void writeIntKey0(int value) throws java.lang.Throwable
java.lang.Throwable
protected abstract void writeStringKey0(java.lang.String value) throws java.lang.Throwable
java.lang.Throwable
protected abstract void writeArrayValueStart0() throws java.lang.Throwable
java.lang.Throwable
protected abstract void writeArrayValueEnd0() throws java.lang.Throwable
java.lang.Throwable
protected abstract void writeMapValueStart0() throws java.lang.Throwable
java.lang.Throwable
protected abstract void writeMapValueEnd0() throws java.lang.Throwable
java.lang.Throwable