/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This is delegates to the real implementation.
*/
public abstract class CDROutputStream
{
/*
private CDROutputStreamBase impl;
protected ORB orb ;
protected ORBUtilSystemException wrapper ;
protected CorbaMessageMediator corbaMessageMediator;
// We can move this out somewhere later. For now, it serves its purpose
// to create a concrete CDR delegate based on the GIOP version.
private static class OutputStreamFactory {
public static CDROutputStreamBase newOutputStream(ORB orb, GIOPVersion version)
{
switch(version.intValue()) {
case GIOPVersion.VERSION_1_0:
return new CDROutputStream_1_0();
case GIOPVersion.VERSION_1_1:
return new CDROutputStream_1_1();
case GIOPVersion.VERSION_1_2:
return new CDROutputStream_1_2();
default:
ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
CORBALogDomains.RPC_ENCODING ) ;
// REVISIT - what is appropriate? INTERNAL exceptions
// are really hard to track later.
throw wrapper.unsupportedGiopVersion( version ) ;
}
}
}
// REVISIT - These two constructors should be re-factored to better hide
// the fact that someone extending this class 'can' construct a CDROutputStream
// that does not use pooled ByteBuffers. Right now, only EncapsOutputStream
// does _not_ use pooled ByteBuffers, see EncapsOutputStream.
// NOTE: When a stream is constructed for non-channel-backed sockets
// it notifies the constructor not to use pooled (i.e, direct)
// ByteBuffers.
public CDROutputStream(ORB orb,
GIOPVersion version,
boolean littleEndian,
BufferManagerWrite bufferManager,
byte streamFormatVersion,
boolean usePooledByteBuffers)
{
impl = OutputStreamFactory.newOutputStream(orb, version);
impl.init(orb, littleEndian, bufferManager, streamFormatVersion, usePooledByteBuffers);
impl.setParent(this);
this.orb = orb ;
this.wrapper = ORBUtilSystemException.get( orb,
CORBALogDomains.RPC_ENCODING ) ;
}
public CDROutputStream(ORB orb,
GIOPVersion version,
boolean littleEndian,
BufferManagerWrite bufferManager,
byte streamFormatVersion)
{
this(orb, version, littleEndian, bufferManager, streamFormatVersion, true);
}
*/
private ByteArrayOutputStream bos ;
private ObjectOutputStream oos ;
public JavaOutputStream()
{
bos = new ByteArrayOutputStream() ;
}
// Provided by IIOPOutputStream and EncapsOutputStream
{
return new JavaInputStream( ois ) ;
}
public final void write_boolean(boolean value) {
}
public final void write_char(char value) {
}
public final void write_wchar(char value) {
}
public final void write_octet(byte value) {
}
public final void write_short(short value) {
}
public final void write_ushort(short value) {
}
public final void write_long(int value) {
}
public final void write_ulong(int value) {
}
public final void write_longlong(long value) {
}
public final void write_ulonglong(long value) {
}
public final void write_float(float value) {
}
public final void write_double(double value) {
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
// org.omg.CORBA_2_3.portable.OutputStream
}
}
}
}
}
// java.io.OutputStream
public final void write(byte b[]) throws IOException {
}
}
public final void flush() throws IOException {
}
public final void close() throws IOException {
}
// com.sun.corba.se.impl.encoding.MarshalOutputStream
public final void start_block() {
impl.start_block();
}
public final void end_block() {
}
public final void putEndian() {
}
throws IOException
{
}
public final byte[] toByteArray() {
return impl.toByteArray();
}
// org.omg.CORBA.DataOutputStream
}
}
}
{
}
public MessageMediator getMessageMediator()
{
return corbaMessageMediator;
}
// org.omg.CORBA.portable.ValueBase
public final String[] _truncatable_ids() {
return impl._truncatable_ids();
}
// Other
protected final int getSize() {
}
protected final int getIndex() {
}
protected int getRealIndex(int index) {
// Used in indirections. Overridden by TypeCodeOutputStream.
return index;
}
}
protected final ByteBuffer getByteBuffer() {
return impl.getByteBuffer();
}
}
public final boolean isLittleEndian() {
return impl.isLittleEndian();
}
// XREVISIT - return to final if possible
// REVISIT - was protected - need access from msgtypes test.
public ByteBufferWithInfo getByteBufferWithInfo() {
return impl.getByteBufferWithInfo();
}
}
// REVISIT: was protected - but need to access from xgiop.
public final BufferManagerWrite getBufferManager() {
return impl.getBufferManager();
}
}
}
public final GIOPVersion getGIOPVersion() {
return impl.getGIOPVersion();
}
}
// Use Latin-1 for GIOP 1.0 or when code set negotiation was not
// performed.
}
// Subclasses must decide what to do here. It's inconvenient to
// make the class and this method abstract because of dup().
protected final void freeInternalCaches() {
}
void printBuffer() {
impl.printBuffer();
}
public void alignOnBoundary(int octetBoundary) {
}
// Needed by request and reply messages for GIOP versions >= 1.2 only.
public void setHeaderPadding(boolean headerPadding) {
}
// ValueOutputStream -----------------------------
}
public void end_value() {
}
}