All Packages Class Hierarchy This Package Previous Next Index
Class com.roguewave.vsj.PortableOutputStream
java.lang.Object
|
+----com.roguewave.vsj.PortableOutputStream
- public class PortableOutputStream
- extends Object
- implements VirtualOutputStream
The PortableOutputStream class corresponds to the Tools.h++
class RWpostream. The class contains methods to output
basic data and save objects to an underlying output stream.
These items can later restored from
either a C++ program using an implementation of the Tools.h++ class
RWpistream or a Java program using class PortableInputStream.
Data written from PortableOutputStream is stored in a human-readable
format which is portable among machines of different architectures.
Each method that writes data is meant to be used in conjuction with
a specific RWpistream (C++)
or PortableInputStream (Java) method to read the data. These
correspondences are given in the method descriptions
below.
With regard to naming conventions, you'll note that
C++ methods in RWpostream that overload the insertion operator
are provided here as methods with names beginning with
insert. For example,
RWvostream& RWvostream::operator<<(char);
is represented here as
VirtualOutputStream PortableOutputStream.insertChar(char);
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
VirtualOutputStream PortableOutputStream.insertUnsignedInt(long)
takes 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 use can hold any
value expected by a C++ program,
in the end we cannot guarantee this since
ranges of basic types in C++ are implementation defined.
- See Also:
- PortableInputStream
-
column_
- Keep track of the column to enhance human readability of output
-
ps_
- The underlying output stream
-
saveContext_
- The store table maintained by this stream.
-
PortableOutputStream(OutputStream)
- Create a PortableOutputStream from the given OutputStream.
-
PortableOutputStream(OutputStream, SaveContext)
- Create a RWpistream from the given InputStream.
-
flush()
- flush the underlying stream
-
getSaveContext()
- Return the save context maintained by this stream.
-
insertChar(char)
- Write a character.
-
insertDouble(double)
- Write a double.
-
insertFloat(float)
- Write a float.
-
insertInt(int)
- Write an int.
-
insertLong(long)
- Write a long.
-
insertShort(short)
- Write a short.
-
insertUnsignedChar(char)
- Write an unsigned character.
-
insertUnsignedInt(long)
- Write an unsigned int.
-
insertUnsignedLong(long)
- Write an unsigned long.
-
insertUnsignedShort(int)
- Write an unsigned short.
-
insertWChar(char)
- Write a wide character.
-
putCChar(char)
-
-
putChar(char)
- Write a character.
-
putChars(char[], int)
- Write an array of characters.
-
putDoubles(double[], int)
- Write an array of doubles.
-
putFloats(float[], int)
- Write an array of floats.
-
putInts(int[], int)
- Write an array of ints.
-
putLongs(long[], int)
- Write an array of longs.
-
putShorts(short[], int)
- Write an array of shorts.
-
putString(String, int)
- Write a string.
-
putUnsigned(char)
- Write an unsigned character.
-
putUnsignedChar(char)
- Write an unsigned character.
-
putUnsignedChars(char[], int)
- Write an array of unsigned characters.
-
putUnsignedInts(long[], int)
- Write an array of unsigned ints.
-
putUnsignedLongs(long[], int)
- Write an array of unsigned longs.
-
putUnsignedShorts(int[], int)
- Write an array of unsigned shorts.
-
putWChar(char)
- Write a wide character.
-
putWChars(char[], int)
- Write an array of wide characters.
-
putwrap(char)
- Print a character, checking the column and moving to the
next line if necessary
-
putwrap(String, int)
- Print a string of characters, checking the column and moving to the
next line if necessary
-
saveObject(Object, ObjectStreamer)
- Write an object to the stream using the given ObjectStreamer.
column_
protected int column_
- Keep track of the column to enhance human readability of output
ps_
protected PrintWriter ps_
- The underlying output stream
saveContext_
protected SaveContext saveContext_
- The store table maintained by this stream. The store
table keeps track of objects as they are written so that
back-references can be used to maintain the shape of a graph
of objects.
PortableOutputStream
public PortableOutputStream(OutputStream ostr)
- Create a PortableOutputStream from the given OutputStream.
This constructor
will initialize the store table with the default SaveContext
with the concrete StoreTable implementation from this package.
- See Also:
- StoreTable
PortableOutputStream
public PortableOutputStream(OutputStream ostr,
SaveContext storetable)
- Create a RWpistream from the given InputStream.
Initialize the stream's SaveContext with storetable.
- See Also:
- StoreTable
saveObject
public VirtualOutputStream saveObject(Object data,
ObjectStreamer streamer) throws IOException
- Write an object to the stream using the given ObjectStreamer.
The ObjectStreamer may call this method recursively
in order to save a graph of objects.
The object may later be restored from either a C++ or a Java
program. The basic types which make up the serialized object
must be read with a corresponding C++ RWpistream or a
Java PortableInputStream. It is up to the ObjectStreamer to
understand how to arrange those basic types, possibly coupled
with additional meta-information, to represent
the object being written.
Note that ObjectStreamers for certain classes in Tools.h++,
JTools, and the JDK are supplied with this product. See the
User's Guide.
getSaveContext
public SaveContext getSaveContext()
- Return the save context maintained by this stream. The save
context keeps track of objects as they are written so that
back-references can be used to maintain the shape of a graph
of objects.
putString
public VirtualOutputStream putString(String data,
int count) throws IOException
- Write a string. Writes at most count characters,
stopping at the end of the string if the string length is less
than count.
Corresponding input functions: |
From C++ | From Java |
RWpistream::getString(const char*, size_t) |
PortableInputStream.getString(int) |
putChar
public VirtualOutputStream putChar(char data) throws IOException
- Write 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 insertChar and
putChar depending on the method to be used to input the
character.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(char) |
PortableInputStream.getChar() |
- See Also:
- insertChar
putUnsignedChar
public VirtualOutputStream putUnsignedChar(char data) throws IOException
- Write 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 insertUnsignedChar and
putUnsignedChar depending on the method
to be used to input the character.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(unsigned char&) |
PortableInputStream.getUnsignedChar() |
- See Also:
- insertUnsignedChar
insertChar
public VirtualOutputStream insertChar(char data) throws IOException
- Write 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 insertChar and
putChar depending on the method to be used to input the
character.
Corresponding input functions: |
From C++ | From Java |
RWpistream::operator>>(char&) |
PortableInputStream.extractChar() |
- See Also:
- putChar
putWChar
public VirtualOutputStream putWChar(char data) throws IOException
- Write 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 insertWChar and
putWChar depending on the method to be used to input the
character.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(wchar_t&) |
PortableInputStream.getWChar() |
- See Also:
- insertWChar
insertWChar
public VirtualOutputStream insertWChar(char data) throws IOException
- Write 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 insertWChar and
putWChar depending on the method to be used to input the
character.
Corresponding input functions: |
From C++ | From Java |
RWpistream::operator>>(wchar_t&) |
PortableInputStream.extractWChar() |
- See Also:
- putWChar
putUnsigned
public VirtualOutputStream putUnsigned(char data) throws IOException
- Write 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 insertUnsignedChar and
putUnsignedChar depending on the method
to be used to input the character.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(unsigned char&) |
PortableInputStream.getUnsignedChar() |
- See Also:
- insertUnsignedChar
insertUnsignedChar
public VirtualOutputStream insertUnsignedChar(char data) throws IOException
- Write 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 insertUnsignedChar and
putUnsignedChar depending on the method to be used
to input the character.
Corresponding input functions: |
From C++ | From Java |
RWpistream::operator>>(unsigned char&) |
PortableInputStream.extractUnsignedChar() |
- See Also:
- putUnsignedChar
insertDouble
public VirtualOutputStream insertDouble(double data) throws IOException
- Write a double.
Corresponding input functions: |
From C++ | From Java |
RWpistream::operator>>(double&) |
PortableInputStream.extractDouble() |
insertFloat
public VirtualOutputStream insertFloat(float data) throws IOException
- Write a float.
Corresponding input functions: |
From C++ | From Java |
RWpistream::operator>>(float&) |
PortableInputStream.extractFloat() |
insertInt
public VirtualOutputStream insertInt(int data) throws IOException
- Write an int.
Corresponding input functions: |
From C++ | From Java |
RWpistream::operator>>(int&) |
PortableInputStream.extractInt() |
insertUnsignedInt
public VirtualOutputStream insertUnsignedInt(long data) throws IOException
- Write an unsigned int.
Corresponding input functions: |
From C++ | From Java |
RWpistream::operator>>(unsigned int&) |
PortableInputStream.extractUnsignedInt() |
insertShort
public VirtualOutputStream insertShort(short data) throws IOException
- Write a short.
Corresponding input functions: |
From C++ | From Java |
RWpistream::operator>>(short&) |
PortableInputStream.extractShort() |
insertUnsignedShort
public VirtualOutputStream insertUnsignedShort(int data) throws IOException
- Write an unsigned short.
Corresponding input functions: |
From C++ | From Java |
RWpistream::operator>>(unsigned short&) |
PortableInputStream.extractUnsignedShort() |
insertLong
public VirtualOutputStream insertLong(long data) throws IOException
- Write a long.
Corresponding input functions: |
From C++ | From Java |
RWpistream::operator>>(long&) |
PortableInputStream.extractLong() |
insertUnsignedLong
public VirtualOutputStream insertUnsignedLong(long data) throws IOException
- Write an unsigned long.
Corresponding input functions: |
From C++ | From Java |
RWpistream::operator>>(unsigned long&) |
PortableInputStream.extractUnsignedLong() |
putChars
public VirtualOutputStream putChars(char data[],
int count) throws IOException
- Write an array of characters.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(char*, size_t) |
PortableInputStream.getChars(int) |
putWChars
public VirtualOutputStream putWChars(char data[],
int count) throws IOException
- Write an array of wide characters.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(wchar_t*, size_t) |
PortableInputStream.getWChars(int) |
putUnsignedChars
public VirtualOutputStream putUnsignedChars(char data[],
int count) throws IOException
- Write an array of unsigned characters.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(unsigned char*, size_t) |
PortableInputStream.getUnsignedChars(int) |
putDoubles
public VirtualOutputStream putDoubles(double data[],
int count) throws IOException
- Write an array of doubles.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(double*, size_t) |
PortableInputStream.getDoubles(int) |
putFloats
public VirtualOutputStream putFloats(float data[],
int count) throws IOException
- Write an array of floats.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(float*, size_t) |
PortableInputStream.getFloats(int) |
putInts
public VirtualOutputStream putInts(int data[],
int count) throws IOException
- Write an array of ints.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(int*, size_t) |
PortableInputStream.getInts(int) |
putUnsignedInts
public VirtualOutputStream putUnsignedInts(long data[],
int count) throws IOException
- Write an array of unsigned ints.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(unsigned int*, size_t) |
PortableInputStream.getunsignedInt(int) |
putShorts
public VirtualOutputStream putShorts(short data[],
int count) throws IOException
- Write an array of shorts.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(short*, size_t) |
PortableInputStream.getShorts(int) |
putUnsignedShorts
public VirtualOutputStream putUnsignedShorts(int data[],
int count) throws IOException
- Write an array of unsigned shorts.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(unsigned short*, size_t) |
PortableInputStream.getUnsignedShorts(int) |
putLongs
public VirtualOutputStream putLongs(long data[],
int count) throws IOException
- Write an array of longs.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(long*, size_t) |
PortableInputStream.getLong(int) |
putUnsignedLongs
public VirtualOutputStream putUnsignedLongs(long data[],
int count) throws IOException
- Write an array of unsigned longs.
Corresponding input functions: |
From C++ | From Java |
RWpistream::get(unsigned long*, size_t) |
PortableInputStream.getUnsignedLong(int) |
flush
public VirtualOutputStream flush() throws IOException
- flush the underlying stream
putCChar
protected void putCChar(char c)
putwrap
protected void putwrap(char c)
- Print a character, checking the column and moving to the
next line if necessary
putwrap
protected void putwrap(String s,
int len)
- Print a string of characters, checking the column and moving to the
next line if necessary
All Packages Class Hierarchy This Package Previous Next Index