public abstract class Any extends Object implements IDLEntity
Any object is used as a component of a
 NamedValue object, which provides information about
 arguments or return values in requests, and which is used to define
 name/value pairs in Context objects.
 
 An Any object consists of two parts:
 
TypeCode object describing the type of the data
 value contained in the Any object.  For example,
 a TypeCode object for an array contains
 a field for the length of the array and a field for
 the type of elements in the array. (Note that in     this case, the
 second field of the TypeCode object is itself a
 TypeCode object.)
 | Constructor and Description | 
|---|
| Any() | 
| Modifier and Type | Method and Description | 
|---|---|
| abstract InputStream | create_input_stream()Creates an input stream from which this  Anyobject's value
 can be unmarshalled. | 
| abstract OutputStream | create_output_stream()Creates an output stream into which this  Anyobject's
 value can be marshalled. | 
| abstract boolean | equal(Any a)Checks for equality between this  Anyobject and the
 givenAnyobject. | 
| abstract Any | extract_any()Extracts the  Anyobject in thisAnyobject'svaluefield. | 
| abstract boolean | extract_boolean()Extracts the  booleanin thisAnyobject'svaluefield. | 
| abstract char | extract_char()Extracts the  charin thisAnyobject'svaluefield. | 
| abstract double | extract_double()Extracts the  doublein thisAnyobject'svaluefield. | 
| BigDecimal | extract_fixed()Extracts the  java.math.BigDecimalobject in thisAnyobject'svaluefield. | 
| abstract float | extract_float()Extracts the  floatin thisAnyobject'svaluefield. | 
| abstract int | extract_long()Extracts the  intin thisAnyobject'svaluefield. | 
| abstract long | extract_longlong()Extracts the  longin thisAnyobject'svaluefield. | 
| abstract Object | extract_Object()Extracts the  org.omg.CORBA.Objectin thisAnyobject'svaluefield. | 
| abstract byte | extract_octet()Extracts the  bytein thisAnyobject'svaluefield. | 
| Principal | extract_Principal()Deprecated. 
 Deprecated by CORBA 2.2. | 
| abstract short | extract_short()Extracts the  shortin thisAnyobject'svaluefield. | 
| Streamable | extract_Streamable()Extracts a  Streamablefrom thisAnyobject'svaluefield. | 
| abstract String | extract_string()Extracts the  Stringobject in thisAnyobject'svaluefield. | 
| abstract TypeCode | extract_TypeCode()Extracts the  TypeCodeobject in thisAnyobject'svaluefield. | 
| abstract int | extract_ulong()Extracts the  intin thisAnyobject'svaluefield. | 
| abstract long | extract_ulonglong()Extracts the  longin thisAnyobject'svaluefield. | 
| abstract short | extract_ushort()Extracts the  shortin thisAnyobject'svaluefield. | 
| abstract Serializable | extract_Value()Extracts the  java.io.Serializableobject in thisAnyobject'svaluefield. | 
| abstract char | extract_wchar()Extracts the  charin thisAnyobject'svaluefield. | 
| abstract String | extract_wstring()Extracts the  Stringobject in thisAnyobject'svaluefield. | 
| abstract void | insert_any(Any a)Inserts the given  Anyobject
 into thisAnyobject'svaluefield. | 
| abstract void | insert_boolean(boolean b)Inserts the given  booleaninto thisAnyobject'svaluefield. | 
| abstract void | insert_char(char c)Inserts the given  charinto thisAnyobject'svaluefield. | 
| abstract void | insert_double(double d)Inserts the given  doubleinto thisAnyobject'svaluefield. | 
| void | insert_fixed(BigDecimal value)Throws an 
  org.omg.CORBA.NO_IMPLEMENTexception. | 
| void | insert_fixed(BigDecimal value,
            TypeCode type)Throws an 
  org.omg.CORBA.NO_IMPLEMENTexception. | 
| abstract void | insert_float(float f)Inserts the given  floatinto thisAnyobject'svaluefield. | 
| abstract void | insert_long(int l)Inserts the given  intinto thisAnyobject'svaluefield. | 
| abstract void | insert_longlong(long l)Inserts the given  longinto thisAnyobject'svaluefield. | 
| abstract void | insert_Object(Object o)Inserts the given  org.omg.CORBA.Objectobject
 into thisAnyobject'svaluefield. | 
| abstract void | insert_Object(Object o,
             TypeCode t)Inserts the given  org.omg.CORBA.Objectobject
 into thisAnyobject'svaluefield. | 
| abstract void | insert_octet(byte b)Inserts the given  byteinto thisAnyobject'svaluefield. | 
| void | insert_Principal(Principal p)Deprecated. 
 Deprecated by CORBA 2.2. | 
| abstract void | insert_short(short s)Inserts the given  shortinto thisAnyobject'svaluefield. | 
| void | insert_Streamable(Streamable s)Inserts the given  Streamableobject
 into thisAnyobject'svaluefield. | 
| abstract void | insert_string(String s)Inserts the given  Stringobject
 into thisAnyobject'svaluefield. | 
| abstract void | insert_TypeCode(TypeCode t)Inserts the given  TypeCodeobject
 into thisAnyobject'svaluefield. | 
| abstract void | insert_ulong(int l)Inserts the given  intinto thisAnyobject'svaluefield. | 
| abstract void | insert_ulonglong(long l)Inserts the given  longinto thisAnyobject'svaluefield. | 
| abstract void | insert_ushort(short s)Inserts the given  shortinto thisAnyobject'svaluefield. | 
| abstract void | insert_Value(Serializable v)Inserts the given  java.io.Serializableobject
 into thisAnyobject'svaluefield. | 
| abstract void | insert_Value(Serializable v,
            TypeCode t)Inserts the given  java.io.Serializableobject
 into thisAnyobject'svaluefield. | 
| abstract void | insert_wchar(char c)Inserts the given  charinto thisAnyobject'svaluefield. | 
| abstract void | insert_wstring(String s)Inserts the given  Stringobject
 into thisAnyobject'svaluefield. | 
| abstract void | read_value(InputStream is,
          TypeCode t)Reads off (unmarshals) the value of an  Anyobject from
 the given input stream using the given typecode. | 
| abstract TypeCode | type()Returns type information for the element contained in this
  Anyobject. | 
| abstract void | type(TypeCode t)Sets this  Anyobject'stypefield
 to the givenTypeCodeobject and clears its value. | 
| abstract void | write_value(OutputStream os)Writes out the value of this  Anyobject
 to the given output stream. | 
public abstract boolean equal(Any a)
Any object and the
 given Any object.  Two Any objects are
 equal if both their values and type codes are equal.a - the Any object to test for equalitytrue if the Any objects are equal;
 false otherwiseCORBA package
      comments for unimplemented featurespublic abstract TypeCode type()
Any object.TypeCode object containing type information
                about the value contained in this Any objectpublic abstract void type(TypeCode t)
Any object's type field
 to the given TypeCode object and clears its value.
 
 Note that using this method to set the type code wipes out the
 value if there is one. The method
 is provided primarily so that the type may be set properly for
 IDL out parameters.  Generally, setting the type
 is done by the insert_X methods, which will set the type
 to X if it is not already set to X.
t - the TypeCode object giving
                information for the value in
                this Any objectpublic abstract void read_value(InputStream is, TypeCode t) throws MARSHAL
Any object from
 the given input stream using the given typecode.is - the org.omg.CORBA.portable.InputStream
                object from which to read
                the value contained in this Any objectt - a TypeCode object containing type information
           about the value to be readMARSHAL - when the given TypeCode object is
                    not consistent with the value that was contained
                    in the input streampublic abstract void write_value(OutputStream os)
Any object
 to the given output stream.  If both typecode
 and value need to be written, use
 create_output_stream() to create an OutputStream,
 then use write_any on the OutputStream.
 
 If this method is called on an Any object that has not
 had a value inserted into its value field, it will throw
 the exception java.lang.NullPointerException.
os - the org.omg.CORBA.portable.OutputStream
                object into which to marshal the value
                of this Any objectpublic abstract OutputStream create_output_stream()
Any object's
 value can be marshalled.OutputStreampublic abstract InputStream create_input_stream()
Any object's value
 can be unmarshalled.InputStreampublic abstract short extract_short()
                             throws BAD_OPERATION
short in this
 Any object's value field.short stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a short or the
              value field has not yet been setpublic abstract void insert_short(short s)
short
 into this Any object's value field.s - the short to insert into this
                Any objectpublic abstract int extract_long()
                          throws BAD_OPERATION
int in this
 Any object's value field.int stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than an int or the
              value field has not yet been setpublic abstract void insert_long(int l)
int
 into this Any object's value field.l - the int to insert into this
                Any objectpublic abstract long extract_longlong()
                               throws BAD_OPERATION
long in this
 Any object's value field.long stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a long or the
              value field has not yet been setpublic abstract void insert_longlong(long l)
long
 into this Any object's value field.l - the long to insert into this
                Any objectpublic abstract short extract_ushort()
                              throws BAD_OPERATION
short in this
 Any object's value field.short stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a short or the
              value field has not yet been setpublic abstract void insert_ushort(short s)
short
 into this Any object's value field.s - the short to insert into this
                Any objectpublic abstract int extract_ulong()
                           throws BAD_OPERATION
int in this
 Any object's value field.int stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than an int or the
              value field has not yet been setpublic abstract void insert_ulong(int l)
int
 into this Any object's value field.l - the int to insert into this
                Any objectpublic abstract long extract_ulonglong()
                                throws BAD_OPERATION
long in this
 Any object's value field.long stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a long or the
              value field has not yet been setpublic abstract void insert_ulonglong(long l)
long
 into this Any object's value field.l - the long to insert into this
                Any objectpublic abstract float extract_float()
                             throws BAD_OPERATION
float in this
 Any object's value field.float stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a float or the
              value field has not yet been setpublic abstract void insert_float(float f)
float
 into this Any object's value field.f - the float to insert into this
                Any objectpublic abstract double extract_double()
                               throws BAD_OPERATION
double in this
 Any object's value field.double stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a double or the
              value field has not yet been setpublic abstract void insert_double(double d)
double
 into this Any object's value field.d - the double to insert into this
                Any objectpublic abstract boolean extract_boolean()
                                 throws BAD_OPERATION
boolean in this
 Any object's value field.boolean stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a boolean or the
              value field has not yet been setpublic abstract void insert_boolean(boolean b)
boolean
 into this Any object's value field.b - the boolean to insert into this
                Any objectpublic abstract char extract_char()
                           throws BAD_OPERATION
char in this
 Any object's value field.char stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a char or the
              value field has not yet been setpublic abstract void insert_char(char c)
                          throws DATA_CONVERSION
char
 into this Any object's value field.c - the char to insert into this
                Any objectDATA_CONVERSION - if there is a data conversion
            errorpublic abstract char extract_wchar()
                            throws BAD_OPERATION
char in this
 Any object's value field.char stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a char or the
              value field has not yet been setpublic abstract void insert_wchar(char c)
char
 into this Any object's value field.c - the char to insert into this
                Any objectpublic abstract byte extract_octet()
                            throws BAD_OPERATION
byte in this
 Any object's value field.byte stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a byte or the
              value field has not yet been setpublic abstract void insert_octet(byte b)
byte
 into this Any object's value field.b - the byte to insert into this
                Any objectpublic abstract Any extract_any() throws BAD_OPERATION
Any object in this
 Any object's value field.Any object stored in this Any objectBAD_OPERATION - if this Any object
              contains something other than an Any object or the
              value field has not yet been setpublic abstract void insert_any(Any a)
Any object
 into this Any object's value field.a - the Any object to insert into this
                Any objectpublic abstract Object extract_Object() throws BAD_OPERATION
org.omg.CORBA.Object in this
 Any object's value field.org.omg.CORBA.Object stored in
         this Any objectBAD_OPERATION - if this  Any object
              contains something other than an
              org.omg.CORBA.Object or the
              value field has not yet been setpublic abstract void insert_Object(Object o)
org.omg.CORBA.Object object
 into this Any object's value field.o - the org.omg.CORBA.Object object to insert into this
                Any objectpublic abstract Serializable extract_Value() throws BAD_OPERATION
java.io.Serializable object in this
 Any object's value field.java.io.Serializable object stored in
         this Any objectBAD_OPERATION - if this  Any object
              contains something other than a java.io.Serializable
              object or the
              value field has not yet been setpublic abstract void insert_Value(Serializable v)
java.io.Serializable object
 into this Any object's value field.v - the java.io.Serializable object to insert into this
                Any objectpublic abstract void insert_Value(Serializable v, TypeCode t) throws MARSHAL
java.io.Serializable object
 into this Any object's value field.v - the java.io.Serializable object to insert into this
                Any objectt - the TypeCode object that is to be inserted into
              this Any object's type field
              and that describes the java.io.Serializable
              object being insertedMARSHAL - if the ORB has a problem marshalling or
          unmarshalling parameterspublic abstract void insert_Object(Object o, TypeCode t) throws BAD_PARAM
org.omg.CORBA.Object object
 into this Any object's value field.o - the org.omg.CORBA.Object instance to insert into this
                Any objectt - the TypeCode object that is to be inserted into
              this Any object and that describes
              the Object being insertedBAD_OPERATION - if this  method is invalid for this
            Any objectBAD_PARAMpublic abstract String extract_string() throws BAD_OPERATION
String object in this
 Any object's value field.String object stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a String object or the
              value field has not yet been setpublic abstract void insert_string(String s) throws DATA_CONVERSION, MARSHAL
String object
 into this Any object's value field.s - the String object to insert into this
                Any objectDATA_CONVERSION - if there is a data conversion errorMARSHAL - if the ORB has a problem marshalling or
             unmarshalling parameterspublic abstract String extract_wstring() throws BAD_OPERATION
String object in this
 Any object's value field.String object stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a String object or the
              value field has not yet been setpublic abstract void insert_wstring(String s) throws MARSHAL
String object
 into this Any object's value field.s - the String object to insert into this
                Any objectMARSHAL - if the ORB has a problem marshalling or
             unmarshalling parameterspublic abstract TypeCode extract_TypeCode() throws BAD_OPERATION
TypeCode object in this
 Any object's value field.TypeCode object stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a TypeCode object or the
              value field has not yet been setpublic abstract void insert_TypeCode(TypeCode t)
TypeCode object
 into this Any object's value field.t - the TypeCode object to insert into this
                Any object@Deprecated public Principal extract_Principal() throws BAD_OPERATION
Principal object in this
 Any object's value field.
 Note that the class Principal has been deprecated.Principal object stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a
              Principal object or the
              value field has not yet been setCORBA package
      comments for unimplemented features@Deprecated public void insert_Principal(Principal p)
Principal object
 into this Any object's value field.
 Note that the class Principal has been deprecated.p - the Principal object to insert into this
                Any objectCORBA package
      comments for unimplemented featurespublic Streamable extract_Streamable() throws BAD_INV_ORDER
Streamable from this Any object's
 value field.  This method allows the extraction of
 non-primitive IDL types.Streamable stored in the Any object.BAD_INV_ORDER - if the caller has invoked operations in the wrong orderCORBA package
      comments for unimplemented featurespublic void insert_Streamable(Streamable s)
Streamable object
 into this Any object's value field.
 This method allows the insertion of non-primitive IDL types.s - the Streamable object to insert into this
                Any object; may be a non-primitive
                IDL typeCORBA package
      comments for unimplemented featurespublic BigDecimal extract_fixed()
java.math.BigDecimal object in this
 Any object's value field.java.math.BigDecimal object
         stored in this Any objectBAD_OPERATION - if this  Any object
              contains something other than a
              java.math.BigDecimal object or the
              value field has not yet been setCORBA package
      comments for unimplemented featurespublic void insert_fixed(BigDecimal value)
org.omg.CORBA.NO_IMPLEMENT exception.
 
 Inserts the given java.math.BigDecimal object
 into this Any object's value field.
value - the java.math.BigDecimal object
                  to insert into this Any objectCORBA package
      comments for unimplemented featurespublic void insert_fixed(BigDecimal value, TypeCode type) throws BAD_INV_ORDER
org.omg.CORBA.NO_IMPLEMENT exception.
 
 Inserts the given java.math.BigDecimal object
 into this Any object's value field.
value - the java.math.BigDecimal object
                  to insert into this Any objecttype - the TypeCode object that is to be inserted into
              this Any object's type field
              and that describes the java.math.BigDecimal
              object being insertedBAD_INV_ORDER - if this method is  invoked improperlyCORBA package
      comments for unimplemented features Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2023, Oracle and/or its affiliates.  All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.