Methods Summary |
---|
public final java.lang.String[] | _truncatable_ids()
throw wrapper.giopVersionError();
|
public void | alignOnBoundary(int octetBoundary)
throw wrapper.giopVersionError();
|
public final void | end_block()
throw wrapper.giopVersionError();
|
public void | end_value()
throw wrapper.giopVersionError();
|
void | freeInternalCaches()
|
public final BufferManagerWrite | getBufferManager()
return bufferManager;
|
public final java.nio.ByteBuffer | getByteBuffer()
throw wrapper.giopVersionError();
|
public ByteBufferWithInfo | getByteBufferWithInfo()
try {
os.flush();
} catch (Exception e) {
throw wrapper.javaSerializationException(
e, "getByteBufferWithInfo");
}
ByteBuffer byteBuffer = ByteBuffer.wrap(bos.getByteArray());
byteBuffer.limit(bos.size());
return new ByteBufferWithInfo(this.orb, byteBuffer, bos.size());
|
public final com.sun.corba.se.spi.ior.iiop.GIOPVersion | getGIOPVersion()
return GIOPVersion.V1_2;
|
public final int | getIndex()
return getSize();
|
protected int | getRealIndex(int index)
return getSize();
|
public final int | getSize()
try {
os.flush();
return bos.size();
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_boolean");
}
|
public void | init(org.omg.CORBA.ORB orb, boolean littleEndian, BufferManagerWrite bufferManager, byte streamFormatVersion, boolean usePooledByteBuffers)
this.orb = (ORB) orb;
this.bufferManager = bufferManager;
wrapper = ORBUtilSystemException.get((ORB) orb,
CORBALogDomains.RPC_ENCODING);
bos =
new _ByteArrayOutputStream(ORBConstants.GIOP_DEFAULT_BUFFER_SIZE);
|
private void | initObjectOutputStream()
//System.out.print(" os ");
if (os != null) {
throw wrapper.javaStreamInitFailed();
}
try {
os = new MarshalObjectOutputStream(bos, orb);
} catch (Exception e) {
throw wrapper.javaStreamInitFailed(e);
}
|
public final boolean | isLittleEndian()
// Java serialization uses network byte order, that is, big-endian.
return false;
|
public final org.omg.CORBA.ORB | orb()
return this.orb;
|
void | printBuffer()
byte[] buf = this.toByteArray();
System.out.println("+++++++ Output Buffer ++++++++");
System.out.println();
System.out.println("Current position: " + buf.length);
//System.out.println("Total length : " + buf.length);
System.out.println();
char[] charBuf = new char[16];
try {
for (int i = 0; i < buf.length; i += 16) {
int j = 0;
// For every 16 bytes, there is one line
// of output. First, the hex output of
// the 16 bytes with each byte separated
// by a space.
while (j < 16 && j + i < buf.length) {
int k = buf[i + j];
if (k < 0)
k = 256 + k;
String hex = Integer.toHexString(k);
if (hex.length() == 1)
hex = "0" + hex;
System.out.print(hex + " ");
j++;
}
// Add any extra spaces to align the
// text column in case we didn't end
// at 16
while (j < 16) {
System.out.print(" ");
j++;
}
// Now output the ASCII equivalents. Non-ASCII
// characters are shown as periods.
int x = 0;
while (x < 16 && x + i < buf.length) {
if (ORBUtility.isPrintable((char)buf[i + x])) {
charBuf[x] = (char) buf[i + x];
} else {
charBuf[x] = '.";
}
x++;
}
System.out.println(new String(charBuf, 0, x));
}
} catch (Throwable t) {
t.printStackTrace();
}
System.out.println("++++++++++++++++++++++++++++++");
|
public final void | putEndian()
throw wrapper.giopVersionError();
|
public final void | setByteBuffer(java.nio.ByteBuffer byteBuffer)
throw wrapper.giopVersionError();
|
public void | setByteBufferWithInfo(ByteBufferWithInfo bbwi)
throw wrapper.giopVersionError();
|
public void | setHeaderPadding(boolean headerPadding)
// no-op. We don't care about body alignment while using
// Java serialization. What the GIOP spec states does not apply here.
|
public final void | setIndex(int value)
throw wrapper.giopVersionError();
|
public final void | start_block()
throw wrapper.giopVersionError();
|
public void | start_value(java.lang.String rep_id)
throw wrapper.giopVersionError();
|
public final byte[] | toByteArray()
try {
os.flush();
return bos.toByteArray(); // new copy.
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "toByteArray");
}
|
public final void | writeIndirection(int tag, int posIndirectedTo)
throw wrapper.giopVersionError();
|
public final void | writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s)
byte[] buf = this.toByteArray(); // new copy.
s.write_long(buf.length);
s.write_octet_array(buf, 0, buf.length);
|
public void | writeTo(java.io.OutputStream s)
try {
os.flush();
bos.writeTo(s);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "writeTo");
}
|
public final void | write_Abstract(java.lang.Object value)
write_abstract_interface(value);
|
public final void | write_Object(org.omg.CORBA.Object value)
if (value == null) {
IOR nullIOR = IORFactories.makeIOR(orb);
nullIOR.write(parent);
return;
}
// IDL to Java formal 01-06-06 1.21.4.2
if (value instanceof org.omg.CORBA.LocalObject) {
throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);
}
IOR ior = ORBUtility.connectAndGetIOR(orb, value);
ior.write(parent);
return;
|
public final void | write_Principal(org.omg.CORBA.Principal p)
// We don't need an implementation for this method, since principal
// is absent in GIOP version 1.2 or above.
write_long(p.name().length);
write_octet_array(p.name(), 0, p.name().length);
|
public final void | write_TypeCode(org.omg.CORBA.TypeCode tc)
if (tc == null) {
throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
}
TypeCodeImpl tci;
if (tc instanceof TypeCodeImpl) {
tci = (TypeCodeImpl) tc;
} else {
tci = new TypeCodeImpl(orb, tc);
}
tci.write_value((org.omg.CORBA_2_3.portable.OutputStream) parent);
|
public final void | write_Value(java.io.Serializable value)
write_value(value);
|
public final void | write_abstract_interface(java.lang.Object obj)
boolean isCorbaObject = false; // Assume value type.
org.omg.CORBA.Object theCorbaObject = null;
// Is it a CORBA.Object?
if (obj != null && obj instanceof org.omg.CORBA.Object) {
theCorbaObject = (org.omg.CORBA.Object)obj;
isCorbaObject = true;
}
// Write the boolean flag.
this.write_boolean(isCorbaObject);
// Now write out the object.
if (isCorbaObject) {
write_Object(theCorbaObject);
} else {
try {
write_value((java.io.Serializable)obj);
} catch(ClassCastException cce) {
if (obj instanceof java.io.Serializable) {
throw cce;
} else {
ORBUtility.throwNotSerializableForCorba(
obj.getClass().getName());
}
}
}
|
public final void | write_any(org.omg.CORBA.Any any)
if (any == null) {
throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
}
write_TypeCode(any.type());
any.write_value(parent);
|
public final void | write_any_array(org.omg.CORBA.Any[] value, int offset, int length)
for(int i = 0; i < length; i++) {
write_any(value[offset + i]);
}
|
public final void | write_boolean(boolean value)
try {
os.writeBoolean(value);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_boolean");
}
|
public final void | write_boolean_array(boolean[] value, int offset, int length)
for (int i = 0; i < length; i++) {
write_boolean(value[offset + i]);
}
|
public final void | write_char(char value)
try {
os.writeChar(value);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_char");
}
|
public final void | write_char_array(char[] value, int offset, int length)
for (int i = 0; i < length; i++) {
write_char(value[offset + i]);
}
|
public final void | write_double(double value)
try {
os.writeDouble(value);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_double");
}
|
public final void | write_double_array(double[] value, int offset, int length)
for (int i = 0; i < length; i++) {
write_double(value[offset + i]);
}
|
public final void | write_fixed(java.math.BigDecimal bigDecimal)
// This string might contain sign and/or dot
this.write_fixed(bigDecimal.toString(), bigDecimal.signum());
|
private void | write_fixed(java.lang.String string, int signum)
int stringLength = string.length();
// Each octet contains (up to) two decimal digits.
byte doubleDigit = 0;
char ch;
byte digit;
// First calculate the string length without optional sign and dot.
int numDigits = 0;
for (int i=0; i<stringLength; i++) {
ch = string.charAt(i);
if (ch == '-" || ch == '+" || ch == '.")
continue;
numDigits++;
}
for (int i=0; i<stringLength; i++) {
ch = string.charAt(i);
if (ch == '-" || ch == '+" || ch == '.")
continue;
digit = (byte)Character.digit(ch, 10);
if (digit == -1) {
throw wrapper.badDigitInFixed(
CompletionStatus.COMPLETED_MAYBE);
}
// If the fixed type has an odd number of decimal digits, then the
// representation begins with the first (most significant) digit.
// Otherwise, this first half-octet is all zero, and the first
// digit is in the second half-octet.
if (numDigits % 2 == 0) {
doubleDigit |= digit;
this.write_octet(doubleDigit);
doubleDigit = 0;
} else {
doubleDigit |= (digit << 4);
}
numDigits--;
}
// The sign configuration in the last half-octet of the representation,
// is 0xD for negative numbers and 0xC for positive and zero values.
if (signum == -1) {
doubleDigit |= 0xd;
} else {
doubleDigit |= 0xc;
}
this.write_octet(doubleDigit);
|
public final void | write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale)
String string = bigDecimal.toString();
String integerPart;
String fractionPart;
StringBuffer stringBuffer;
// Get rid of the sign
if (string.charAt(0) == '-" || string.charAt(0) == '+") {
string = string.substring(1);
}
// Determine integer and fraction parts
int dotIndex = string.indexOf('.");
if (dotIndex == -1) {
integerPart = string;
fractionPart = null;
} else if (dotIndex == 0 ) {
integerPart = null;
fractionPart = string;
} else {
integerPart = string.substring(0, dotIndex);
fractionPart = string.substring(dotIndex + 1);
}
// Pad both parts with zeros as necessary
stringBuffer = new StringBuffer(digits);
if (fractionPart != null) {
stringBuffer.append(fractionPart);
}
while (stringBuffer.length() < scale) {
stringBuffer.append('0");
}
if (integerPart != null) {
stringBuffer.insert(0, integerPart);
}
while (stringBuffer.length() < digits) {
stringBuffer.insert(0, '0");
}
// This string contains no sign or dot
this.write_fixed(stringBuffer.toString(), bigDecimal.signum());
|
public final void | write_float(float value)
try {
os.writeFloat(value);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_float");
}
|
public final void | write_float_array(float[] value, int offset, int length)
for (int i = 0; i < length; i++) {
write_float(value[offset + i]);
}
|
public final void | write_long(int value)
// check if size < [ GIOPHeader(12) + requestID(4)] bytes
if (bos.size() < directWriteLength) {
// Use big endian (network byte order). This is fixed.
// Both the writer and reader use the same byte order.
bos.write((byte)((value >>> 24) & 0xFF));
bos.write((byte)((value >>> 16) & 0xFF));
bos.write((byte)((value >>> 8) & 0xFF));
bos.write((byte)((value >>> 0) & 0xFF));
if (bos.size() == directWriteLength) {
initObjectOutputStream();
} else if (bos.size() > directWriteLength) {
// Cannot happen. All direct writes are contained
// within the first 16 bytes.
wrapper.javaSerializationException("write_long");
}
return;
}
try {
os.writeInt(value);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_long");
}
|
public final void | write_long_array(int[] value, int offset, int length)
for (int i = 0; i < length; i++) {
write_long(value[offset + i]);
}
|
public final void | write_longlong(long value)
try {
os.writeLong(value);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_longlong");
}
|
public final void | write_longlong_array(long[] value, int offset, int length)
for (int i = 0; i < length; i++) {
write_longlong(value[offset + i]);
}
|
public final void | write_octet(byte value)
// check if size < [ GIOPHeader(12) + requestID(4)] bytes
if (bos.size() < directWriteLength) {
bos.write(value); // direct write.
if (bos.size() == directWriteLength) {
initObjectOutputStream();
}
return;
}
try {
os.writeByte(value);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_octet");
}
|
public final void | write_octet_array(byte[] value, int offset, int length)
try {
os.write(value, offset, length);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_octet_array");
}
|
public final void | write_short(short value)
try {
os.writeShort(value);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_short");
}
|
public final void | write_short_array(short[] value, int offset, int length)
for (int i = 0; i < length; i++) {
write_short(value[offset + i]);
}
|
public final void | write_string(java.lang.String value)
try {
os.writeUTF(value);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_string");
}
|
public final void | write_ulong(int value)
this.write_long(value);
|
public final void | write_ulong_array(int[] value, int offset, int length)
write_long_array(value, offset, length);
|
public final void | write_ulonglong(long value)
this.write_longlong(value);
|
public final void | write_ulonglong_array(long[] value, int offset, int length)
write_longlong_array(value, offset, length);
|
public final void | write_ushort(short value)
this.write_short(value);
|
public final void | write_ushort_array(short[] value, int offset, int length)
write_short_array(value, offset, length);
|
public final void | write_value(java.io.Serializable value)
write_value(value, (String) null);
|
public final void | write_value(java.io.Serializable value, java.lang.Class clz)
write_value(value);
|
public final void | write_value(java.io.Serializable value, java.lang.String repository_id)
try {
os.writeObject(value);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_value");
}
|
public final void | write_value(java.io.Serializable value, org.omg.CORBA.portable.BoxedValueHelper factory)
this.write_value(value, (String) null);
|
public final void | write_wchar(char value)
this.write_char(value);
|
public final void | write_wchar_array(char[] value, int offset, int length)
write_char_array(value, offset, length);
|
public final void | write_wstring(java.lang.String value)
try {
os.writeObject(value);
} catch (Exception e) {
throw wrapper.javaSerializationException(e, "write_wstring");
}
|