public byte[] encode(Any data) throws InvalidTypeForEncoding { final CDROutputStream out = new CDROutputStream(orb); try { out.beginEncapsulatedArray(); out.write_any(data); // do not end encapsulation since it will patch the // array with a size! return out.getBufferCopy(); } finally { out.close(); } }
/** * Writes an abstract interface to this stream. The abstract interface is * written as a union with a boolean discriminator, which is true if the * union contains a CORBA object reference, or false if the union contains * a value. */ @Override public void write_abstract_interface(final java.lang.Object object) { if (object instanceof org.omg.CORBA.Object) { write_boolean(true); write_Object((org.omg.CORBA.Object)object); } else { write_boolean(false); write_value((java.io.Serializable)object); } }
@Override public final void write_long(final int value) { check(7,4); _write4int(buffer,pos,value); pos += 4; index += 4; }
write_short( input.read_short()); break; write_long( input.read_long()); break; write_ushort(input.read_ushort()); break; write_ulong( input.read_ulong()); break; write_float( input.read_float()); break; write_double(input.read_double()); break; write_boolean( input.read_boolean()); break; write_char( input.read_char()); break; write_octet( input.read_octet()); break; write_any( input.read_any()); break;
write_previous_chunk_size(); check(7,4); getValueMap().put(value, Integer.valueOf(size())); write_value_header(repository_ids); start_chunk(); write_wstring((String)value); end_chunk(); ValueHandler.getRMIRepositoryID(javax.rmi.CORBA.ClassDesc.class) }; write_value_header(repository_ids); start_chunk(); write_value(ValueHandler.getCodebase((Class)value)); write_value(ValueHandler.getRMIRepositoryID((Class)value)); end_chunk(); write_value_header( streamable._truncatable_ids() ); start_chunk(); ((org.omg.CORBA.portable.StreamableValue)value)._write(this); end_chunk(); write_value_header ( ((org.omg.CORBA.portable.CustomValue )value )._truncatable_ids() ); ( ( org.omg.CORBA.portable.CustomValue ) value ).marshal( outputStream ); write_value_header( repository_ids, codebase ); start_chunk(); if (writeMethod == null)
private static String iorToString(IOR ior) { try { CDROutputStream out = new CDROutputStream(); // endianness = false, big-endian out.write_boolean(false); org.omg.IOP.IORHelper.write(out, ior); byte bytes[] = out.getBufferCopy(); StringBuffer sb = new StringBuffer("IOR:"); for (int j=0; j<bytes.length; j++) { int b = bytes[j]; if(b<0) b+= 256; int n1 = (0xff & b) / 16; int n2 = (0xff & b) % 16; int c1 = (n1 < 10) ? ('0' + n1) : ('a' + (n1 - 10)); int c2 = (n2 < 10) ? ('0' + n2) : ('a' + (n2 - 10)); sb.append((char)c1); sb.append((char)c2); } return sb.toString(); } catch (Exception e) { return null; } }
@Override public void write_value(final java.io.Serializable value, final org.omg.CORBA.portable.BoxedValueHelper factory) { if (!write_special_value (value)) { write_previous_chunk_size(); check(7,4); getValueMap().put (value, Integer.valueOf(size())); if (((value instanceof org.omg.CORBA.portable.IDLEntity) || isSimpleString(value, factory))) { write_long (0x7fffff00 | chunkingFlag); } else { // repository id is required for RMI: types write_long (0x7fffff02 | chunkingFlag); final String repId = factory.get_id(); write_repository_id (repId); } start_chunk(); factory.write_value (this, value); end_chunk(); } }
public ExceptionHolderImpl(ORB orb, org.omg.CORBA.SystemException exception) { this(orb); is_system_exception = true; byte_order = false; final CDROutputStream out = new CDROutputStream(orb); try { SystemExceptionHelper.write(out, exception); marshaled_exception = out.getBufferCopy(); } finally { out.close(); } }
CDROutputStream os = new CDROutputStream (orb); os.check (length, MulticastUtil.BOUNDARY); os.write_octet_array (data, offset, length); byte[] buffer = os.getBufferCopy ();
private TaggedProfile createMultipleComponentsProfile (TaggedComponentList components) { CDROutputStream out = new CDROutputStream(this); out.beginEncapsulatedArray(); MultipleComponentProfileHelper.write(out, components.asArray()); return new TaggedProfile ( TAG_MULTIPLE_COMPONENTS.value, out.getBufferCopy() ); }
check(8,4); getEncapsStack().push getValueMap(), getRepIdMap(), getCodebaseMap()) ); beginEncapsulatedArray();
private boolean compareComplexValue(org.omg.CORBA.Any other) { final CDROutputStream thisStream; if (value instanceof CDROutputStream) { thisStream = (CDROutputStream)value; } else { thisStream = new CDROutputStream(orb); write_value(thisStream); } final CDROutputStream otherStream; if (other instanceof Any && ((Any) other).value instanceof CDROutputStream) { otherStream = (CDROutputStream) ((Any) other).value; } else { otherStream = new CDROutputStream(orb); other.write_value( otherStream ); } return Arrays.equals( thisStream.getBufferCopy(), otherStream.getBufferCopy()); } }
(8 - ((Messages.MSG_HEADER_SIZE + ctx_out.size ()) % 8)); difference = (difference == 8)? 0 : difference; ctx_out.reduceSize( 4 ); ctx_out.write_ulong( difference ); ctx_out.increaseSize( difference ); - Messages.MSG_HEADER_SIZE - 4 + ctx_out.size() ); ctx_out.write( conn, 0, ctx_out.size() ); int new_header_end = getHeaderEnd() - 4 + ctx_out.size(); ctx_out.increaseSize( difference ); - 4 - getHeaderPadding() + ctx_out.size() ); ctx_out.write( conn, 0, ctx_out.size()); ctx_out.close(); ctx_out = null;
os.beginEncapsulatedArray (); profiles[i].profile_data = os.getBufferCopy (); os.close();
private CDROutputStream createContextStream() { final CDROutputStream out = new CDROutputStream( orb ); //write the length of the service context array. out.write_ulong( contexts.size() ); for( int i = 0; i < contexts.size(); i++ ) { ServiceContextHelper.write( out, (ServiceContext) contexts.get( i )); } return out; }
public void writeTypeCode(TypeCode typeCode, CDROutputStream out, Map recursiveTCMap, Map repeatedTCMap) { final int kind = typeCode.kind().value(); out.write_long(kind); out.beginEncapsulation(); try { out.write_TypeCode( typeCode.content_type(), recursiveTCMap, repeatedTCMap); out.write_long(typeCode.length()); out.endEncapsulation(); } catch (BadKind e) { assert false; throw new RuntimeException(e); } } }
private void tryWriteTypeCode(TypeCode typeCode, CDROutputStream out, Map recursiveTCMap, Map repeatedTCMap) throws BadKind, Bounds { final int kind = typeCode.kind().value(); out.write_long( kind ); // remember tc start pos before we start writing it // out final Integer startPosition = Integer.valueOf(out.get_pos()); recursiveTCMap.put( typeCode.id(), startPosition ); out.beginEncapsulation(); doWriteTypeCodeParameters(typeCode, out, recursiveTCMap, repeatedTCMap); out.endEncapsulation(); recursiveTCMap.remove(typeCode.id()); // add typecode to cache not until here to account for // recursive TCs repeatedTCMap.put(typeCode, startPosition); }
write_long(0); return; write_long( 1 ); write_octet( (byte)0 ); check(size, 4); sizePosition = pos; _write4int( buffer, sizePosition, size);
toUse = ((CDROutputStream) output).orb(); final CDRInputStream in = new CDRInputStream(toUse, out.getBufferCopy ());
public org.omg.CORBA.portable.OutputStream create_output_stream() { value = new CDROutputStream( orb ); return (CDROutputStream)value; }