Package com.sun.corba.ee.impl.ior
Class EncapsulationUtility
java.lang.Object
com.sun.corba.ee.impl.ior.EncapsulationUtility
This static utility class contains various utility methods for reading and
writing CDR encapsulations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStream
getEncapsulationStream
(ORB orb, InputStream is) Helper method to read the octet array from is, deencapsulate it, and return as another InputStream.static <E extends Identifiable>
voidreadIdentifiableSequence
(List<E> container, IdentifiableFactoryFinder<E> finder, InputStream istr) Read the count from is, then read count Identifiables from is using the factory.static byte[]
Helper method that reads an octet array from an input stream.static void
writeEncapsulation
(WriteContents obj, OutputStream os) static <E extends Identifiable>
voidwriteIdentifiableSequence
(List<E> container, OutputStream os) Write all Identifiables that we contain to os.static void
writeOutputStream
(OutputStream dataStream, OutputStream os) Helper method that is used to extract data from an output stream and write the data to another output stream.
-
Constructor Details
-
EncapsulationUtility
private EncapsulationUtility()
-
-
Method Details
-
readIdentifiableSequence
public static <E extends Identifiable> void readIdentifiableSequence(List<E> container, IdentifiableFactoryFinder<E> finder, InputStream istr) Read the count from is, then read count Identifiables from is using the factory. Add each constructed Identifiable to container.- Type Parameters:
E
- extendsIdentifiable
- Parameters:
container
- List to add constructed Identifiables tofinder
- Factory to use in creationistr
- Stream to read from
-
writeIdentifiableSequence
public static <E extends Identifiable> void writeIdentifiableSequence(List<E> container, OutputStream os) Write all Identifiables that we contain to os. The total length must be written before this method is called.- Type Parameters:
E
- extendsIdentifiable
- Parameters:
container
- List of Identifiablesos
- Stream to write to
-
writeOutputStream
Helper method that is used to extract data from an output stream and write the data to another output stream. Defined as static so that it can be used in another class.- Parameters:
dataStream
- Stream to get data fromos
- Stream to write to
-
getEncapsulationStream
Helper method to read the octet array from is, deencapsulate it, and return as another InputStream. This must be called inside the constructor of a derived class to obtain the correct stream for unmarshalling data.- Parameters:
orb
- The ORBis
- Stream to read from- Returns:
- Deencapsulated InputStream
-
readOctets
Helper method that reads an octet array from an input stream. Defined as static here so that it can be used in another class.- Parameters:
is
- Stream to read from- Returns:
- Array of bytes from stream
-
writeEncapsulation
-