Interface COM.ibm.jaws.mofw.InputEDStream
All Packages Class Hierarchy This Package Previous Next Index
Interface COM.ibm.jaws.mofw.InputEDStream
- public interface InputEDStream
- extends Object
InputEDStream is one of the primary mechanisms used
in the object server. InputEDStream comes in many
subclasses with special constructors, methods, and internal
representations. An InputEDStream can be very light-weight
(e.g., a sequence of three values) or very complex (e.g., an
iterator over all the Managed objects in a large database).
This interface is similar to the CORBA StreamIO interface.
It differs mainly in that Java has fewer atomic types than
CORBA.
In OOD terms, an InputEDStream is the MOFW representation
of a "source" process and dataflow that generates data in a form
accepted by some other dataflow or process. In this case the
canonical form consists the MOFW datatypes.
These methods each throw a EDStreamFormatError. Like
other Java Errors, they do not require the client to
either use the catch/throw mechanism or require a throws
in the implementation of the method.
It is always the responsibility of the client of a
InputEDStream to know what order to read from the InputEDStream.
-
atEnd()
- Use this method to determine if the stream is currently at an end marker
or the true end of stream.
-
readBegin()
- Use this method to begin reading a variable length sequence from this
stream.
-
readBoolean()
- Use this method to read a boolean from the stream.
-
readByte()
- Use this method to read an uninterpreted byte from this stream.
-
readChar()
- Use this method to read a char from this stream.
-
readDouble()
- Use this method to read a double from this stream.
-
readEnd()
- Use this method to consume stream entries up to and including the next
end marker or the true end of stream (if no intermediate marker is reached).
-
readFloat()
- Use this method to read a float from this stream.
-
readInt()
- Use this method to read an int from this stream.
-
readLong()
- Use this method to read a long from this stream.
-
readManageable()
-
Use readManageable() and writeManageable() when you want to
write the object's EssentialData and not preserve its identity.
-
readManaged(BaseCollection)
- Use writeManaged() and readManaged() when you want identity
to be preserved.
-
readObject()
- Use readObject() and writeObject() when you want the stream to
handle
- A Managed object as readManaged() and writeManaged().
-
readShort()
- Use this method to read a short from this stream.
-
readString()
- Use this method to read a string from this stream.
atEnd
public abstract boolean atEnd()
- Use this method to determine if the stream is currently at an end marker
or the true end of stream. The marker is not "consumed."
readBegin
public abstract void readBegin() throws EDStreamFormatError
- Use this method to begin reading a variable length sequence from this
stream. The expectation is that a begin marker is in the stream.
- Throws: EDStreamFormatError
- is raised when the next item in the
InputEDStream is not a begin marker.
readEnd
public abstract void readEnd()
- Use this method to consume stream entries up to and including the next
end marker or the true end of stream (if no intermediate marker is reached).
readBoolean
public abstract boolean readBoolean() throws EDStreamFormatError
- Use this method to read a boolean from the stream.
- Returns:
- the
boolean
repesenting the next item in the stream.
- Throws: EDStreamFormatError
- is raised when the next item in the
InputEDStream is not a boolean.
readByte
public abstract byte readByte() throws EDStreamFormatError
- Use this method to read an uninterpreted byte from this stream. For
CORBA compliance we may need to change this to readOctet (or add a
method).
- Returns:
- the
byte
repesenting the next item in the stream.
- Throws: EDStreamFormatError
- is raised when the next item in the
InputEDStream is not a byte.
readShort
public abstract short readShort() throws EDStreamFormatError
- Use this method to read a short from this stream.
- Returns:
- the
short
repesenting the next item in the stream.
- Throws: EDStreamFormatError
- is raised when the next item in the
InputEDStream is not a short.
readInt
public abstract int readInt() throws EDStreamFormatError
- Use this method to read an int from this stream.
- Returns:
- the
int
repesenting the next item in the stream.
- Throws: EDStreamFormatError
- is raised when the next item in the
InputEDStream is not a int.
readLong
public abstract long readLong() throws EDStreamFormatError
- Use this method to read a long from this stream.
- Returns:
- the
long
repesenting the next item in the stream.
- Throws: EDStreamFormatError
- is raised when the next item in the
InputEDStream is not an long.
readFloat
public abstract float readFloat() throws EDStreamFormatError
- Use this method to read a float from this stream.
- Returns:
- the
float
repesenting the next item in the stream.
- Throws: EDStreamFormatError
- is raised when the next item in the
InputEDStream is not a float.
readDouble
public abstract double readDouble() throws EDStreamFormatError
- Use this method to read a double from this stream.
- Returns:
- the
double
repesenting the next item in the stream.
- Throws: EDStreamFormatError
- is raised when the next item in the
InputEDStream is not a double.
readChar
public abstract char readChar() throws EDStreamFormatError
- Use this method to read a char from this stream.
- Returns:
- the
char
repesenting the next item in the stream.
- Throws: EDStreamFormatError
- is raised when the next item in the
InputEDStream is not a char.
readString
public abstract String readString() throws EDStreamFormatError
- Use this method to read a string from this stream.
- Returns:
- the
string
repesenting the next item in the stream.
- Throws: EDStreamFormatError
- is raised when the next item in the
InputEDStream is not a string.
readObject
public abstract Object readObject() throws EDStreamFormatError
- Use readObject() and writeObject() when you want the stream to
handle
- A Managed object as readManaged() and writeManaged().
- A Manageable non-Managed object as readManageable() and
writeManageable().
- A null object.
- Returns:
- the
Object
that is the next item in the stream.
- Throws: EDStreamFormatError
- is raised when the next item in
the InputEDStream is not an object of the (optionally) specified type.
readManageable
public abstract Manageable readManageable() throws EDStreamFormatError
- Use readManageable() and writeManageable() when you want to
write the object's EssentialData and not preserve its identity.
This method should handle the following cases:
- A Manageable object (this implies a Managed).
- A null object.
In all cases, a writeManageable() and subsequent readManageable()
will create a new object with the same EssentialData.
- Returns:
- the
Manageable
object that is the next
item in the stream.
- Throws: EDStreamFormatError
- is raised when the
OutputEDStream expects something other than an object
of the type passed in.
readManaged
public abstract Managed readManaged(BaseCollection relativeTo) throws EDStreamFormatError
- Use writeManaged() and readManaged() when you want identity
to be preserved. That is, if the Managed object is
already in memory, then that object is found instead of
creating a new copy. This implies that enough of the object's
Identifier must be included in the stream to ensure
single-copy semantics. Whether the state of the Managed
object is included in the stream, via externalizeToStream()
and internalizeFromStream(), is up to the stream implementation.
This allows (but does not require) multiple objects to be
included in the same stream as performance dictates.
In the following code,
Managed foo, bar;
myStream.writeManaged(foo);
bar = myStream.readManaged();
boolean identical = foo.isIdentical(bar);
the boolean identical is true.
These methods should be contrasted with writeManageable() and
readManageable(), which only preserve equality. In the following
code,
Manageable foo, bar;
myStream.writeManageable(foo);
bar = myStream.readManageable();
boolean identical = foo.isIdentical(bar);
boolean equal = foo.equals(bar);
the boolean identical is false and the boolean equal is true.
This method should support at least the following types:
- A Managed object.
- A null object.
- Parameters:
- relativeTo - determines how much of the Identifier is
included in the stream. If null, the stream may use its
root BaseCollection or may throw an exception. The relativeTo
for a corresponding pair of writeManaged() and readManaged()
should be the same.
- Returns:
- the
Managed
that is the next item in the stream.
- Throws: EDStreamFormatError
- is raised when the next item
in the InputEDStream is not an Managed object of the
(optionally) specified type.
All Packages Class Hierarchy This Package Previous Next Index