1 7 8 package com.sun.corba.se.impl.encoding; 9 10 import org.omg.CORBA.CompletionStatus ; 11 12 import com.sun.corba.se.spi.orb.ORB; 13 14 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 15 16 import com.sun.corba.se.impl.encoding.CodeSetConversion; 17 import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; 18 import com.sun.corba.se.impl.encoding.CDROutputStream; 19 import com.sun.corba.se.impl.encoding.BufferManagerWrite; 20 import com.sun.corba.se.impl.encoding.BufferManagerFactory; 21 import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; 22 import com.sun.corba.se.impl.orbutil.ORBConstants; 23 24 37 public class EncapsOutputStream extends CDROutputStream 38 { 39 40 final static boolean usePooledByteBuffers = false; 46 47 51 public EncapsOutputStream(ORB orb) { 57 this(orb, GIOPVersion.V1_2); 60 } 61 62 public EncapsOutputStream(ORB orb, GIOPVersion version) { 67 this(orb, version, false); 68 } 69 70 public EncapsOutputStream(ORB orb, boolean isLittleEndian) { 73 this(orb, GIOPVersion.V1_2, isLittleEndian); 74 } 75 76 public EncapsOutputStream(ORB orb, 77 GIOPVersion version, 78 boolean isLittleEndian) 79 { 80 super(orb, version, Message.CDR_ENC_VERSION, isLittleEndian, 81 BufferManagerFactory.newBufferManagerWrite( 82 BufferManagerFactory.GROW, 83 Message.CDR_ENC_VERSION, 84 orb), 85 ORBConstants.STREAM_FORMAT_VERSION_1, 86 usePooledByteBuffers); 87 } 88 89 public org.omg.CORBA.portable.InputStream create_input_stream() { 90 freeInternalCaches(); 91 92 return new EncapsInputStream(orb(), 93 getByteBuffer(), 94 getSize(), 95 isLittleEndian(), 96 getGIOPVersion()); 97 } 98 99 protected CodeSetConversion.CTBConverter createCharCTBConverter() { 100 return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1); 101 } 102 103 protected CodeSetConversion.CTBConverter createWCharCTBConverter() { 104 if (getGIOPVersion().equals(GIOPVersion.V1_0)) 105 throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE); 106 107 if (getGIOPVersion().equals(GIOPVersion.V1_1)) 110 return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16, 111 isLittleEndian(), 112 false); 113 114 119 boolean useBOM = ((ORB)orb()).getORBData().useByteOrderMarkersInEncapsulations(); 120 121 return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16, 122 false, 123 useBOM); 124 } 125 } 126 | Popular Tags |