All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.roguewave.vsj.PortableInputStream

java.lang.Object
   |
   +----com.roguewave.vsj.PortableInputStream

public class PortableInputStream
extends Object
implements VirtualInputStream
Class PortableInputStream corresponds to the Tools.h++ class RWpistream. The class contains methods to input basic data and restore objects. These items may have been written from either a C++ program using the Tools.h++ class RWpostream, or a Java program using the PortableOutputStream interface.

Each method that reads data is meant to be used in conjuction with a specific RWpostream or PortableOutputStream method that wrote the data. These correspondences are given in the method descriptions below.

With regard to naming conventions, you'll note that C++ methods in RWpistream that overload the extraction operator are provided here as method names beginning with extract. For example,

   RWvistream& RWpistream::operator>>(char&);
 
is represented here as
   char PortableInputStream.extractChar();
 
Also, because we can't directly pass basic types by reference in Java, the input methods take no parameters but return the value instead. This, in turn, means that we can't overload the method names as we do in C++, thus we include the type in the name as with extractChar(), extractInt(), etc.

Finally, we use widening, where we can, to deal with C++ basic types such as unsigned int that don't have Java counterparts. For example, the method

   long PortableInputStream.extractUnsignedInt()
 
returns a long since the range of a typical C++ unsigned int contains values that won't necessarily fit into a Java int. While we've done our best to ensure that the types we return can hold any value read from the stream, in the end we cannot guarantee this since ranges of basic types in C++ are implementation defined.

See Also:
PortableOutputStream

Variable Index

 o istr_
A reader for the underlying input stream.
 o restoreContext_
The restore context can be used to keep track of object references as they are read, enabling one to maintain the shape of a graph of objets.

Constructor Index

 o PortableInputStream(InputStream)
Create a PortableInputStream from the given InputStream.
 o PortableInputStream(InputStream, RestoreContext)
Create a PortableInputStream from the given InputStream.

Method Index

 o extractChar()
Read a character.
 o extractDouble()
Read a double.
 o extractFloat()
Read a float.
 o extractInt()
Read an int.
 o extractLong()
Read a long.
 o extractShort()
Read a short.
 o extractUnsignedChar()
Read an unsigned character.
 o extractUnsignedInt()
Read an unsigned int.
 o extractUnsignedLong()
Read an unsigned long.
 o extractUnsignedShort()
Read an unsigned short.
 o extractWChar()
Read a wide character.
 o getChar()
Read a character.
 o getChars(int)
Read an array of characters.
 o getDoubles(int)
Read an array of doubles.
 o getFloats(int)
Read an array of floats.
 o getInts(int)
Read an array of ints.
 o getLongs(int)
Read an array of longs.
 o getRestoreContext()
Get the restore context maintained by this stream.
 o getShorts(int)
Read an array of shorts.
 o getString(int)
Read a string.
 o getUnsignedChar()
Read an unsigned character.
 o getUnsignedChars(int)
Read an array of unsigned characters.
 o getUnsignedInts(int)
Read an array of unsigned ints.
 o getUnsignedLongs(int)
Read an array of unsigned longs.
 o getUnsignedShorts(int)
Read an array of unsigned shorts.
 o getWChar()
Read a wide character.
 o getWChars(int)
Read an array of wide characters.
 o restoreObject(ObjectStreamer)
Read an object from the stream using the given ObjectStreamer.

Variables

 o istr_
 protected PushbackReader istr_
A reader for the underlying input stream.

 o restoreContext_
 protected RestoreContext restoreContext_
The restore context can be used to keep track of object references as they are read, enabling one to maintain the shape of a graph of objets.

Constructors

 o PortableInputStream
 public PortableInputStream(InputStream istr)
Create a PortableInputStream from the given InputStream. This constructor will initialize the RestoreContext with the default ReadTable implementation from this package.

See Also:
RestoreContext
 o PortableInputStream
 public PortableInputStream(InputStream istr,
                            RestoreContext readtable)
Create a PortableInputStream from the given InputStream. Intialize the stream's RestoreContext with readtable.

Methods

 o restoreObject
 public Object restoreObject(ObjectStreamer streamer) throws IOException
Read an object from the stream using the given ObjectStreamer. The object may have been saved from either a C++ or a Java program. The basic types which make up the serialized object must have been written with a C++ RWpostream or a Java PortableOutputStream. It is up to the ObjectStreamer to understand how those basic types, along with any meta-information, are arranged to represent the object.

Note that ObjectStreamers for certain classes in Tools.h++, JTools, and the JDK are supplied with this product. See the User's Guide.

 o getRestoreContext
 public RestoreContext getRestoreContext()
Get the restore context maintained by this stream. The restore context keeps track of objects as they are read in so that back-references can be used to maintain the shape of a graph of objects.

 o getString
 public String getString(int count) throws IOException
Read a string. Reads at most count characters. If more characters were output to the stream, eats the excess characters so that the stream remains in sync.

Corresponding output functions:
From C++From Java
RWpostream::putString(const char*, size_t) PortableOutputStream.putString(String, int)

 o extractChar
 public char extractChar() throws IOException
Read a character. The C++ virtual stream interface allows for two different ways of interpreting a char: as a character, or as a number. Although this distinction doesn't really apply to Java, it is still important to choose the correct method between extractChar and getChar depending on the method used to output the character.

Corresponding output functions:
From C++From Java
RWpostream::operator<<(char) PortableOutputStream.insertChar(char)

See Also:
getChar
 o getChar
 public char getChar() throws IOException
Read a character. The C++ virtual stream interface allows for two different ways of interpreting a char: as a character, or as a number. Although this distinction doesn't really apply to Java, it is still important to choose the correct method between extractChar and getChar depending on the method used to output the character.

Corresponding output functions:
From C++From Java
RWpostream::put(char) PortableOutputStream.putChar(char)

See Also:
extractChar
 o extractWChar
 public char extractWChar() throws IOException
Read a wide character. The C++ virtual stream interface allows for two different ways of interpreting a wchar_t: as a character, or as a number. Although this distinction doesn't really apply to Java, it is still important to choose the correct method between extractWChar and getWChar depending on the method used to output the character.

Corresponding output functions:
From C++From Java
RWpostream::operator<<(wchar_t) PortableOutputStream.insertWChar(char)

See Also:
getWChar
 o getWChar
 public char getWChar() throws IOException
Read a wide character. The C++ virtual stream interface allows for two different ways of interpreting a wchar_t: as a character, or as a number. Although this distinction doesn't really apply to Java, it is still important to choose the correct method between extractWChar and getWChar depending on the method used to output the character.

Corresponding output functions:
From C++From Java
RWpostream::put(wchar_t) PortableOutputStream.putWChar(char)

See Also:
extractWChar
 o extractUnsignedChar
 public char extractUnsignedChar() throws IOException
Read an unsigned character. The C++ virtual stream interface allows for two different ways of interpreting an unsigned char: as a character, or as a number. Although this distinction doesn't really apply to Java, it is still important to choose the correct method between extractUnsignedChar and getUnsignedChar depending on the method used to output the character.

Corresponding output functions:
From C++From Java
RWpostream::operator<<(unsigned char) PortableOutputStream.insertUnsignedChar(char)

See Also:
getUnsignedChar
 o getUnsignedChar
 public char getUnsignedChar() throws IOException
Read an unsigned character. The C++ virtual stream interface allows for two different ways of interpreting an unsigned char: as a character, or as a number. Although this distinction doesn't really apply to Java, it is still important to choose the correct method between extractUnsignedChar and getUnsignedChar depending on the method used to output the character.

Corresponding output functions:
From C++From Java
RWpostream::put(unsigned char) PortableOutputStream.putUnsignedChar(char)

See Also:
extractUnsignedChar
 o extractDouble
 public double extractDouble() throws IOException
Read a double.

Corresponding output functions:
From C++From Java
RWpostream::operator<<(double) PortableOutputStream.insertDouble(double)

 o extractFloat
 public float extractFloat() throws IOException
Read a float.

Corresponding output functions:
From C++From Java
RWpostream::operator<<(float) PortableOutputStream.insertFloat(float)

 o extractInt
 public int extractInt() throws IOException
Read an int.

Corresponding output functions:
From C++From Java
RWpostream::operator<<(int) PortableOutputStream.insertInt(int)

 o extractUnsignedInt
 public long extractUnsignedInt() throws IOException
Read an unsigned int.

Corresponding output functions:
From C++From Java
RWpostream::operator<<(unsigned int) PortableOutputStream.insertUnsignedInt(long)

 o extractShort
 public short extractShort() throws IOException
Read a short.

Corresponding output functions:
From C++From Java
RWpostream::operator<<(short) PortableOutputStream.insertShort(short)

 o extractUnsignedShort
 public int extractUnsignedShort() throws IOException
Read an unsigned short.

Corresponding output functions:
From C++From Java
RWpostream::operator<<(unsigned short) PortableOutputStream.insertUnsignedShort(int)

 o extractLong
 public long extractLong() throws IOException
Read a long.

Corresponding output functions:
From C++From Java
RWpostream::operator<<(long) PortableOutputStream.insertLong(long)

 o extractUnsignedLong
 public long extractUnsignedLong() throws IOException
Read an unsigned long.

Corresponding output functions:
From C++From Java
RWpostream::operator<<(unsigned long) PortableOutputStream.insertUnsignedLong(long)

 o getChars
 public char[] getChars(int count) throws IOException
Read an array of characters.

Corresponding output functions:
From C++From Java
RWpostream::put(const char*, size_t) PortableOutputStream.putChars(char[], int)

 o getWChars
 public char[] getWChars(int count) throws IOException
Read an array of wide characters.

Corresponding output functions:
From C++From Java
RWpostream::put(const wchar_t*, size_t) PortableOutputStream.putWChars(char[], int)

 o getUnsignedChars
 public char[] getUnsignedChars(int count) throws IOException
Read an array of unsigned characters.

Corresponding output functions:
From C++From Java
RWpostream::put(const unsigned char*, size_t) PortableOutputStream.putUnsignedChars(char[], int)

 o getDoubles
 public double[] getDoubles(int count) throws IOException
Read an array of doubles.

Corresponding output functions:
From C++From Java
RWpostream::put(const double*, size_t) PortableOutputStream.putDoubles(double[], int)

 o getFloats
 public float[] getFloats(int count) throws IOException
Read an array of floats.

Corresponding output functions:
From C++From Java
RWpostream::put(const float*, size_t) PortableOutputStream.putFloats(float[], int)

 o getInts
 public int[] getInts(int count) throws IOException
Read an array of ints.

Corresponding output functions:
From C++From Java
RWpostream::put(const int*, size_t) PortableOutputStream.putInts(int[], int)

 o getUnsignedInts
 public long[] getUnsignedInts(int count) throws IOException
Read an array of unsigned ints.

Corresponding output functions:
From C++From Java
RWpostream::put(const unsigned int*, size_t) PortableOutputStream.putunsignedInt(long[], int)

 o getShorts
 public short[] getShorts(int count) throws IOException
Read an array of shorts.

Corresponding output functions:
From C++From Java
RWpostream::put(const short*, size_t) PortableOutputStream.putShorts(short[], int)

 o getUnsignedShorts
 public int[] getUnsignedShorts(int count) throws IOException
Read an array of unsigned shorts.

Corresponding output functions:
From C++From Java
RWpostream::put(const unsigned short*, size_t) PortableOutputStream.putUnsignedShorts(int[], int)

 o getLongs
 public long[] getLongs(int count) throws IOException
Read an array of longs.

Corresponding output functions:
From C++From Java
RWpostream::put(const long*, size_t) PortableOutputStream.putLong(long[], int)

 o getUnsignedLongs
 public long[] getUnsignedLongs(int count) throws IOException
Read an array of unsigned longs.

Corresponding output functions:
From C++From Java
RWpostream::put(const unsigned long*, size_t) PortableOutputStream.putUnsignedLong(long[], int)


All Packages  Class Hierarchy  This Package  Previous  Next  Index