Java Code Examples for org.omg.CORBA.OctetSeqHelper

The following are top voted examples for showing how to use org.omg.CORBA.OctetSeqHelper. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Given the input stream, this fills our service
 * context map.  See the definition of scMap for
 * details.  Creates a HashMap.
 *
 * Note that we don't actually unmarshal the
 * bytes of the service contexts here.  That is
 * done when they are actually requested via
 * get(int).
 */
private void createMapFromInputStream(InputStream is)
{
    orb = (ORB)(is.orb()) ;
    if (orb.serviceContextDebugFlag)
        dprint( "Constructing ServiceContexts from input stream" ) ;

    int numValid = is.read_long() ;

    if (orb.serviceContextDebugFlag)
        dprint("Number of service contexts = " + numValid);

    for (int ctr = 0; ctr < numValid; ctr++) {
        int scId = is.read_long();

        if (orb.serviceContextDebugFlag)
            dprint("Reading service context id " + scId);

        byte[] data = OctetSeqHelper.read(is);

        if (orb.serviceContextDebugFlag)
            dprint("Service context" + scId + " length: " + data.length);

        scMap.put(new Integer(scId), data);
    }
}
 
Example 2
Project: OpenJSharp   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Write the given entry from the scMap to the OutputStream.
 * See note on giopVersion.  The service context should
 * know the GIOP version it is meant for.
 */
private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {

    // If it's still in byte[] form, we don't need to
    // unmarshal it here, just copy the bytes into
    // the new stream.

    if (scObj instanceof byte[]) {
        if (isDebugging(os))
            dprint( "Writing service context bytes for id " + id);

        OctetSeqHelper.write(os, (byte[])scObj);

    } else {

        // We actually unmarshaled it into a ServiceContext
        // at some point.
        ServiceContext sc = (ServiceContext)scObj;

        if (isDebugging(os))
            dprint( "Writing service context " + sc ) ;

        sc.write(os, gv);
    }
}
 
Example 3
Project: openjdk-jdk10   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Given the input stream, this fills our service
 * context map.  See the definition of scMap for
 * details.  Creates a HashMap.
 *
 * Note that we don't actually unmarshal the
 * bytes of the service contexts here.  That is
 * done when they are actually requested via
 * get(int).
 */
private void createMapFromInputStream(InputStream is)
{
    orb = (ORB)(is.orb()) ;
    if (orb.serviceContextDebugFlag)
        dprint( "Constructing ServiceContexts from input stream" ) ;

    int numValid = is.read_long() ;

    if (orb.serviceContextDebugFlag)
        dprint("Number of service contexts = " + numValid);

    for (int ctr = 0; ctr < numValid; ctr++) {
        int scId = is.read_long();

        if (orb.serviceContextDebugFlag)
            dprint("Reading service context id " + scId);

        byte[] data = OctetSeqHelper.read(is);

        if (orb.serviceContextDebugFlag)
            dprint("Service context" + scId + " length: " + data.length);

        scMap.put(new Integer(scId), data);
    }
}
 
Example 4
Project: openjdk-jdk10   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Write the given entry from the scMap to the OutputStream.
 * See note on giopVersion.  The service context should
 * know the GIOP version it is meant for.
 */
private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {

    // If it's still in byte[] form, we don't need to
    // unmarshal it here, just copy the bytes into
    // the new stream.

    if (scObj instanceof byte[]) {
        if (isDebugging(os))
            dprint( "Writing service context bytes for id " + id);

        OctetSeqHelper.write(os, (byte[])scObj);

    } else {

        // We actually unmarshaled it into a ServiceContext
        // at some point.
        ServiceContext sc = (ServiceContext)scObj;

        if (isDebugging(os))
            dprint( "Writing service context " + sc ) ;

        sc.write(os, gv);
    }
}
 
Example 5
Project: openjdk9   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Given the input stream, this fills our service
 * context map.  See the definition of scMap for
 * details.  Creates a HashMap.
 *
 * Note that we don't actually unmarshal the
 * bytes of the service contexts here.  That is
 * done when they are actually requested via
 * get(int).
 */
private void createMapFromInputStream(InputStream is)
{
    orb = (ORB)(is.orb()) ;
    if (orb.serviceContextDebugFlag)
        dprint( "Constructing ServiceContexts from input stream" ) ;

    int numValid = is.read_long() ;

    if (orb.serviceContextDebugFlag)
        dprint("Number of service contexts = " + numValid);

    for (int ctr = 0; ctr < numValid; ctr++) {
        int scId = is.read_long();

        if (orb.serviceContextDebugFlag)
            dprint("Reading service context id " + scId);

        byte[] data = OctetSeqHelper.read(is);

        if (orb.serviceContextDebugFlag)
            dprint("Service context" + scId + " length: " + data.length);

        scMap.put(new Integer(scId), data);
    }
}
 
Example 6
Project: openjdk9   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Write the given entry from the scMap to the OutputStream.
 * See note on giopVersion.  The service context should
 * know the GIOP version it is meant for.
 */
private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {

    // If it's still in byte[] form, we don't need to
    // unmarshal it here, just copy the bytes into
    // the new stream.

    if (scObj instanceof byte[]) {
        if (isDebugging(os))
            dprint( "Writing service context bytes for id " + id);

        OctetSeqHelper.write(os, (byte[])scObj);

    } else {

        // We actually unmarshaled it into a ServiceContext
        // at some point.
        ServiceContext sc = (ServiceContext)scObj;

        if (isDebugging(os))
            dprint( "Writing service context " + sc ) ;

        sc.write(os, gv);
    }
}
 
Example 7
Project: lookaside_java-1.8.0-openjdk   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Given the input stream, this fills our service
 * context map.  See the definition of scMap for
 * details.  Creates a HashMap.
 *
 * Note that we don't actually unmarshal the
 * bytes of the service contexts here.  That is
 * done when they are actually requested via
 * get(int).
 */
private void createMapFromInputStream(InputStream is)
{
    orb = (ORB)(is.orb()) ;
    if (orb.serviceContextDebugFlag)
        dprint( "Constructing ServiceContexts from input stream" ) ;

    int numValid = is.read_long() ;

    if (orb.serviceContextDebugFlag)
        dprint("Number of service contexts = " + numValid);

    for (int ctr = 0; ctr < numValid; ctr++) {
        int scId = is.read_long();

        if (orb.serviceContextDebugFlag)
            dprint("Reading service context id " + scId);

        byte[] data = OctetSeqHelper.read(is);

        if (orb.serviceContextDebugFlag)
            dprint("Service context" + scId + " length: " + data.length);

        scMap.put(new Integer(scId), data);
    }
}
 
Example 8
Project: lookaside_java-1.8.0-openjdk   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Write the given entry from the scMap to the OutputStream.
 * See note on giopVersion.  The service context should
 * know the GIOP version it is meant for.
 */
private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {

    // If it's still in byte[] form, we don't need to
    // unmarshal it here, just copy the bytes into
    // the new stream.

    if (scObj instanceof byte[]) {
        if (isDebugging(os))
            dprint( "Writing service context bytes for id " + id);

        OctetSeqHelper.write(os, (byte[])scObj);

    } else {

        // We actually unmarshaled it into a ServiceContext
        // at some point.
        ServiceContext sc = (ServiceContext)scObj;

        if (isDebugging(os))
            dprint( "Writing service context " + sc ) ;

        sc.write(os, gv);
    }
}
 
Example 9
Project: jdk8u_corba   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Given the input stream, this fills our service
 * context map.  See the definition of scMap for
 * details.  Creates a HashMap.
 *
 * Note that we don't actually unmarshal the
 * bytes of the service contexts here.  That is
 * done when they are actually requested via
 * get(int).
 */
private void createMapFromInputStream(InputStream is)
{
    orb = (ORB)(is.orb()) ;
    if (orb.serviceContextDebugFlag)
        dprint( "Constructing ServiceContexts from input stream" ) ;

    int numValid = is.read_long() ;

    if (orb.serviceContextDebugFlag)
        dprint("Number of service contexts = " + numValid);

    for (int ctr = 0; ctr < numValid; ctr++) {
        int scId = is.read_long();

        if (orb.serviceContextDebugFlag)
            dprint("Reading service context id " + scId);

        byte[] data = OctetSeqHelper.read(is);

        if (orb.serviceContextDebugFlag)
            dprint("Service context" + scId + " length: " + data.length);

        scMap.put(new Integer(scId), data);
    }
}
 
Example 10
Project: jdk8u_corba   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Write the given entry from the scMap to the OutputStream.
 * See note on giopVersion.  The service context should
 * know the GIOP version it is meant for.
 */
private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {

    // If it's still in byte[] form, we don't need to
    // unmarshal it here, just copy the bytes into
    // the new stream.

    if (scObj instanceof byte[]) {
        if (isDebugging(os))
            dprint( "Writing service context bytes for id " + id);

        OctetSeqHelper.write(os, (byte[])scObj);

    } else {

        // We actually unmarshaled it into a ServiceContext
        // at some point.
        ServiceContext sc = (ServiceContext)scObj;

        if (isDebugging(os))
            dprint( "Writing service context " + sc ) ;

        sc.write(os, gv);
    }
}
 
Example 11
Project: infobip-open-jdk-8   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Given the input stream, this fills our service
 * context map.  See the definition of scMap for
 * details.  Creates a HashMap.
 *
 * Note that we don't actually unmarshal the
 * bytes of the service contexts here.  That is
 * done when they are actually requested via
 * get(int).
 */
private void createMapFromInputStream(InputStream is)
{
    orb = (ORB)(is.orb()) ;
    if (orb.serviceContextDebugFlag)
        dprint( "Constructing ServiceContexts from input stream" ) ;

    int numValid = is.read_long() ;

    if (orb.serviceContextDebugFlag)
        dprint("Number of service contexts = " + numValid);

    for (int ctr = 0; ctr < numValid; ctr++) {
        int scId = is.read_long();

        if (orb.serviceContextDebugFlag)
            dprint("Reading service context id " + scId);

        byte[] data = OctetSeqHelper.read(is);

        if (orb.serviceContextDebugFlag)
            dprint("Service context" + scId + " length: " + data.length);

        scMap.put(new Integer(scId), data);
    }
}
 
Example 12
Project: infobip-open-jdk-8   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Write the given entry from the scMap to the OutputStream.
 * See note on giopVersion.  The service context should
 * know the GIOP version it is meant for.
 */
private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {

    // If it's still in byte[] form, we don't need to
    // unmarshal it here, just copy the bytes into
    // the new stream.

    if (scObj instanceof byte[]) {
        if (isDebugging(os))
            dprint( "Writing service context bytes for id " + id);

        OctetSeqHelper.write(os, (byte[])scObj);

    } else {

        // We actually unmarshaled it into a ServiceContext
        // at some point.
        ServiceContext sc = (ServiceContext)scObj;

        if (isDebugging(os))
            dprint( "Writing service context " + sc ) ;

        sc.write(os, gv);
    }
}
 
Example 13
Project: openjdk-source-code-learn   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Given the input stream, this fills our service
 * context map.  See the definition of scMap for
 * details.  Creates a HashMap.
 *
 * Note that we don't actually unmarshal the
 * bytes of the service contexts here.  That is
 * done when they are actually requested via
 * get(int).
 */
private void createMapFromInputStream(InputStream is)
{
    orb = (ORB)(is.orb()) ;
    if (orb.serviceContextDebugFlag)
        dprint( "Constructing ServiceContexts from input stream" ) ;

    int numValid = is.read_long() ;

    if (orb.serviceContextDebugFlag)
        dprint("Number of service contexts = " + numValid);

    for (int ctr = 0; ctr < numValid; ctr++) {
        int scId = is.read_long();

        if (orb.serviceContextDebugFlag)
            dprint("Reading service context id " + scId);

        byte[] data = OctetSeqHelper.read(is);

        if (orb.serviceContextDebugFlag)
            dprint("Service context" + scId + " length: " + data.length);

        scMap.put(new Integer(scId), data);
    }
}
 
Example 14
Project: openjdk-source-code-learn   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Write the given entry from the scMap to the OutputStream.
 * See note on giopVersion.  The service context should
 * know the GIOP version it is meant for.
 */
private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {

    // If it's still in byte[] form, we don't need to
    // unmarshal it here, just copy the bytes into
    // the new stream.

    if (scObj instanceof byte[]) {
        if (isDebugging(os))
            dprint( "Writing service context bytes for id " + id);

        OctetSeqHelper.write(os, (byte[])scObj);

    } else {

        // We actually unmarshaled it into a ServiceContext
        // at some point.
        ServiceContext sc = (ServiceContext)scObj;

        if (isDebugging(os))
            dprint( "Writing service context " + sc ) ;

        sc.write(os, gv);
    }
}
 
Example 15
Project: OLD-OpenJDK8   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Given the input stream, this fills our service
 * context map.  See the definition of scMap for
 * details.  Creates a HashMap.
 *
 * Note that we don't actually unmarshal the
 * bytes of the service contexts here.  That is
 * done when they are actually requested via
 * get(int).
 */
private void createMapFromInputStream(InputStream is)
{
    orb = (ORB)(is.orb()) ;
    if (orb.serviceContextDebugFlag)
        dprint( "Constructing ServiceContexts from input stream" ) ;

    int numValid = is.read_long() ;

    if (orb.serviceContextDebugFlag)
        dprint("Number of service contexts = " + numValid);

    for (int ctr = 0; ctr < numValid; ctr++) {
        int scId = is.read_long();

        if (orb.serviceContextDebugFlag)
            dprint("Reading service context id " + scId);

        byte[] data = OctetSeqHelper.read(is);

        if (orb.serviceContextDebugFlag)
            dprint("Service context" + scId + " length: " + data.length);

        scMap.put(new Integer(scId), data);
    }
}
 
Example 16
Project: OLD-OpenJDK8   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Write the given entry from the scMap to the OutputStream.
 * See note on giopVersion.  The service context should
 * know the GIOP version it is meant for.
 */
private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {

    // If it's still in byte[] form, we don't need to
    // unmarshal it here, just copy the bytes into
    // the new stream.

    if (scObj instanceof byte[]) {
        if (isDebugging(os))
            dprint( "Writing service context bytes for id " + id);

        OctetSeqHelper.write(os, (byte[])scObj);

    } else {

        // We actually unmarshaled it into a ServiceContext
        // at some point.
        ServiceContext sc = (ServiceContext)scObj;

        if (isDebugging(os))
            dprint( "Writing service context " + sc ) ;

        sc.write(os, gv);
    }
}
 
Example 17
Project: openjdk-orb   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Given the input stream, this fills our service
 * context map.  See the definition of scMap for
 * details.  Creates a HashMap.
 *
 * Note that we don't actually unmarshal the
 * bytes of the service contexts here.  That is
 * done when they are actually requested via
 * get(int).
 */
private void createMapFromInputStream(InputStream is)
{
    orb = (ORB)(is.orb()) ;
    if (orb.serviceContextDebugFlag)
        dprint( "Constructing ServiceContexts from input stream" ) ;

    int numValid = is.read_long() ;

    if (orb.serviceContextDebugFlag)
        dprint("Number of service contexts = " + numValid);

    for (int ctr = 0; ctr < numValid; ctr++) {
        int scId = is.read_long();

        if (orb.serviceContextDebugFlag)
            dprint("Reading service context id " + scId);

        byte[] data = OctetSeqHelper.read(is);

        if (orb.serviceContextDebugFlag)
            dprint("Service context" + scId + " length: " + data.length);

        scMap.put(new Integer(scId), data);
    }
}
 
Example 18
Project: openjdk-orb   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Write the given entry from the scMap to the OutputStream.
 * See note on giopVersion.  The service context should
 * know the GIOP version it is meant for.
 */
private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {

    // If it's still in byte[] form, we don't need to
    // unmarshal it here, just copy the bytes into
    // the new stream.

    if (scObj instanceof byte[]) {
        if (isDebugging(os))
            dprint( "Writing service context bytes for id " + id);

        OctetSeqHelper.write(os, (byte[])scObj);

    } else {

        // We actually unmarshaled it into a ServiceContext
        // at some point.
        ServiceContext sc = (ServiceContext)scObj;

        if (isDebugging(os))
            dprint( "Writing service context " + sc ) ;

        sc.write(os, gv);
    }
}
 
Example 19
Project: openjdk-icedtea7   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Given the input stream, this fills our service
 * context map.  See the definition of scMap for
 * details.  Creates a HashMap.
 *
 * Note that we don't actually unmarshal the
 * bytes of the service contexts here.  That is
 * done when they are actually requested via
 * get(int).
 */
private void createMapFromInputStream(InputStream is)
{
    orb = (ORB)(is.orb()) ;
    if (orb.serviceContextDebugFlag)
        dprint( "Constructing ServiceContexts from input stream" ) ;

    int numValid = is.read_long() ;

    if (orb.serviceContextDebugFlag)
        dprint("Number of service contexts = " + numValid);

    for (int ctr = 0; ctr < numValid; ctr++) {
        int scId = is.read_long();

        if (orb.serviceContextDebugFlag)
            dprint("Reading service context id " + scId);

        byte[] data = OctetSeqHelper.read(is);

        if (orb.serviceContextDebugFlag)
            dprint("Service context" + scId + " length: " + data.length);

        scMap.put(new Integer(scId), data);
    }
}
 
Example 20
Project: openjdk-icedtea7   File: ServiceContexts.java   View source code 6 votes vote down vote up
/**
 * Write the given entry from the scMap to the OutputStream.
 * See note on giopVersion.  The service context should
 * know the GIOP version it is meant for.
 */
private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {

    // If it's still in byte[] form, we don't need to
    // unmarshal it here, just copy the bytes into
    // the new stream.

    if (scObj instanceof byte[]) {
        if (isDebugging(os))
            dprint( "Writing service context bytes for id " + id);

        OctetSeqHelper.write(os, (byte[])scObj);

    } else {

        // We actually unmarshaled it into a ServiceContext
        // at some point.
        ServiceContext sc = (ServiceContext)scObj;

        if (isDebugging(os))
            dprint( "Writing service context " + sc ) ;

        sc.write(os, gv);
    }
}
 
Example 21
Project: javify   File: ObjectIdHelper.java   View source code 4 votes vote down vote up
/**
 * Return an alias typecode (an alias of the octet sequence).
 */
public static TypeCode type()
{
  ORB orb = OrbRestricted.Singleton;
  return orb.create_alias_tc(id(), "ObjectId", OctetSeqHelper.type());
}
 
Example 22
Project: javify   File: ArrayValueHelper.java   View source code 4 votes vote down vote up
/**
 * Write the array to the input stream.
 */
public void write_value(OutputStream output, Serializable value)
{
  if (output instanceof gnuValueStream)
    {
      gnuRuntime r = ((gnuValueStream) output).getRunTime();
      if (r != null)
        r.target = null;
    }

  if (value instanceof byte[])
    OctetSeqHelper.write(output, (byte[]) value);
  else if (value instanceof String[])
    {
      String[] s = (String[]) value;
      output.write_long(s.length);
      for (int i = 0; i < s.length; i++)
        Vio.write(output, s[i], Vio.m_StringValueHelper);
    }
  else if (value instanceof int[])
    LongSeqHelper.write(output, (int[]) value);
  else if (value instanceof long[])
    LongLongSeqHelper.write(output, (long[]) value);
  else if (value instanceof double[])
    DoubleSeqHelper.write(output, (double[]) value);
  else if (value instanceof float[])
    FloatSeqHelper.write(output, (float[]) value);
  else if (value instanceof boolean[])
    BooleanSeqHelper.write(output, (boolean[]) value);
  else if (value instanceof short[])
    ShortSeqHelper.write(output, (short[]) value);
  else if (value instanceof char[])
    CharSeqHelper.write(output, (char[]) value);
  else
    {
      // Write others, use reflection.
      component = arrayClass.getComponentType();

      int n = Array.getLength(value);
      output.write_long(n);
      if (written_as_object())
        for (int i = 0; i < n; i++)
          {
            Object o = Array.get(value, i);
            if (o == null)
              output.write_Object(null);
            else
              // CORBA objects have another notation.
              handler.writeValue(output, (Serializable) o);
          }
      else
        {
          for (int i = 0; i < n; i++)
            Vio.write(output, (Serializable) Array.get(value, i),
              component);
        }

    }
}
 
Example 23
Project: jvm-stm   File: ObjectIdHelper.java   View source code 4 votes vote down vote up
/**
 * Return an alias typecode (an alias of the octet sequence).
 */
public static TypeCode type()
{
  ORB orb = OrbRestricted.Singleton;
  return orb.create_alias_tc(id(), "ObjectId", OctetSeqHelper.type());
}
 
Example 24
Project: jvm-stm   File: ArrayValueHelper.java   View source code 4 votes vote down vote up
/**
 * Write the array to the input stream.
 */
public void write_value(OutputStream output, Serializable value)
{
  if (output instanceof gnuValueStream)
    {
      gnuRuntime r = ((gnuValueStream) output).getRunTime();
      if (r != null)
        r.target = null;
    }

  if (value instanceof byte[])
    OctetSeqHelper.write(output, (byte[]) value);
  else if (value instanceof String[])
    {
      String[] s = (String[]) value;
      output.write_long(s.length);
      for (int i = 0; i < s.length; i++)
        Vio.write(output, s[i], Vio.m_StringValueHelper);
    }
  else if (value instanceof int[])
    LongSeqHelper.write(output, (int[]) value);
  else if (value instanceof long[])
    LongLongSeqHelper.write(output, (long[]) value);
  else if (value instanceof double[])
    DoubleSeqHelper.write(output, (double[]) value);
  else if (value instanceof float[])
    FloatSeqHelper.write(output, (float[]) value);
  else if (value instanceof boolean[])
    BooleanSeqHelper.write(output, (boolean[]) value);
  else if (value instanceof short[])
    ShortSeqHelper.write(output, (short[]) value);
  else if (value instanceof char[])
    CharSeqHelper.write(output, (char[]) value);
  else
    {
      // Write others, use reflection.
      component = arrayClass.getComponentType();

      int n = Array.getLength(value);
      output.write_long(n);
      if (written_as_object())
        for (int i = 0; i < n; i++)
          {
            Object o = Array.get(value, i);
            if (o == null)
              output.write_Object(null);
            else
              // CORBA objects have another notation.
              handler.writeValue(output, (Serializable) o);
          }
      else
        {
          for (int i = 0; i < n; i++)
            Vio.write(output, (Serializable) Array.get(value, i),
              component);
        }

    }
}
 
Example 25
Project: JamVM-PH   File: ObjectIdHelper.java   View source code 4 votes vote down vote up
/**
 * Return an alias typecode (an alias of the octet sequence).
 */
public static TypeCode type()
{
  ORB orb = OrbRestricted.Singleton;
  return orb.create_alias_tc(id(), "ObjectId", OctetSeqHelper.type());
}
 
Example 26
Project: JamVM-PH   File: ArrayValueHelper.java   View source code 4 votes vote down vote up
/**
 * Write the array to the input stream.
 */
public void write_value(OutputStream output, Serializable value)
{
  if (output instanceof gnuValueStream)
    {
      gnuRuntime r = ((gnuValueStream) output).getRunTime();
      if (r != null)
        r.target = null;
    }

  if (value instanceof byte[])
    OctetSeqHelper.write(output, (byte[]) value);
  else if (value instanceof String[])
    {
      String[] s = (String[]) value;
      output.write_long(s.length);
      for (int i = 0; i < s.length; i++)
        Vio.write(output, s[i], Vio.m_StringValueHelper);
    }
  else if (value instanceof int[])
    LongSeqHelper.write(output, (int[]) value);
  else if (value instanceof long[])
    LongLongSeqHelper.write(output, (long[]) value);
  else if (value instanceof double[])
    DoubleSeqHelper.write(output, (double[]) value);
  else if (value instanceof float[])
    FloatSeqHelper.write(output, (float[]) value);
  else if (value instanceof boolean[])
    BooleanSeqHelper.write(output, (boolean[]) value);
  else if (value instanceof short[])
    ShortSeqHelper.write(output, (short[]) value);
  else if (value instanceof char[])
    CharSeqHelper.write(output, (char[]) value);
  else
    {
      // Write others, use reflection.
      component = arrayClass.getComponentType();

      int n = Array.getLength(value);
      output.write_long(n);
      if (written_as_object())
        for (int i = 0; i < n; i++)
          {
            Object o = Array.get(value, i);
            if (o == null)
              output.write_Object(null);
            else
              // CORBA objects have another notation.
              handler.writeValue(output, (Serializable) o);
          }
      else
        {
          for (int i = 0; i < n; i++)
            Vio.write(output, (Serializable) Array.get(value, i),
              component);
        }

    }
}
 
Example 27
Project: classpath   File: ObjectIdHelper.java   View source code 4 votes vote down vote up
/**
 * Return an alias typecode (an alias of the octet sequence).
 */
public static TypeCode type()
{
  ORB orb = OrbRestricted.Singleton;
  return orb.create_alias_tc(id(), "ObjectId", OctetSeqHelper.type());
}
 
Example 28
Project: classpath   File: ArrayValueHelper.java   View source code 4 votes vote down vote up
/**
 * Write the array to the input stream.
 */
public void write_value(OutputStream output, Serializable value)
{
  if (output instanceof gnuValueStream)
    {
      gnuRuntime r = ((gnuValueStream) output).getRunTime();
      if (r != null)
        r.target = null;
    }

  if (value instanceof byte[])
    OctetSeqHelper.write(output, (byte[]) value);
  else if (value instanceof String[])
    {
      String[] s = (String[]) value;
      output.write_long(s.length);
      for (int i = 0; i < s.length; i++)
        Vio.write(output, s[i], Vio.m_StringValueHelper);
    }
  else if (value instanceof int[])
    LongSeqHelper.write(output, (int[]) value);
  else if (value instanceof long[])
    LongLongSeqHelper.write(output, (long[]) value);
  else if (value instanceof double[])
    DoubleSeqHelper.write(output, (double[]) value);
  else if (value instanceof float[])
    FloatSeqHelper.write(output, (float[]) value);
  else if (value instanceof boolean[])
    BooleanSeqHelper.write(output, (boolean[]) value);
  else if (value instanceof short[])
    ShortSeqHelper.write(output, (short[]) value);
  else if (value instanceof char[])
    CharSeqHelper.write(output, (char[]) value);
  else
    {
      // Write others, use reflection.
      component = arrayClass.getComponentType();

      int n = Array.getLength(value);
      output.write_long(n);
      if (written_as_object())
        for (int i = 0; i < n; i++)
          {
            Object o = Array.get(value, i);
            if (o == null)
              output.write_Object(null);
            else
              // CORBA objects have another notation.
              handler.writeValue(output, (Serializable) o);
          }
      else
        {
          for (int i = 0; i < n; i++)
            Vio.write(output, (Serializable) Array.get(value, i),
              component);
        }

    }
}
 
Example 29
Project: javify   File: ObjectIdHelper.java   View source code 2 votes vote down vote up
/**
 * Read the Object Id as a byte array.
 *
 * @param input the stream to read from.
 */
public static byte[] read(InputStream input)
{
  return OctetSeqHelper.read(input);
}
 
Example 30
Project: javify   File: ObjectIdHelper.java   View source code 2 votes vote down vote up
/**
 * Write the Object Id as a byte array.
 *
 * @param output the stream to write into.
 * @param value the Object Id value to write.
 */
public static void write(OutputStream output, byte[] value)
{
  OctetSeqHelper.write(output, value);
}
 
Example 31
Project: jvm-stm   File: ObjectIdHelper.java   View source code 2 votes vote down vote up
/**
 * Read the Object Id as a byte array.
 *
 * @param input the stream to read from.
 */
public static byte[] read(InputStream input)
{
  return OctetSeqHelper.read(input);
}
 
Example 32
Project: jvm-stm   File: ObjectIdHelper.java   View source code 2 votes vote down vote up
/**
 * Write the Object Id as a byte array.
 *
 * @param output the stream to write into.
 * @param value the Object Id value to write.
 */
public static void write(OutputStream output, byte[] value)
{
  OctetSeqHelper.write(output, value);
}
 
Example 33
Project: JamVM-PH   File: ObjectIdHelper.java   View source code 2 votes vote down vote up
/**
 * Read the Object Id as a byte array.
 *
 * @param input the stream to read from.
 */
public static byte[] read(InputStream input)
{
  return OctetSeqHelper.read(input);
}
 
Example 34
Project: JamVM-PH   File: ObjectIdHelper.java   View source code 2 votes vote down vote up
/**
 * Write the Object Id as a byte array.
 *
 * @param output the stream to write into.
 * @param value the Object Id value to write.
 */
public static void write(OutputStream output, byte[] value)
{
  OctetSeqHelper.write(output, value);
}
 
Example 35
Project: classpath   File: ObjectIdHelper.java   View source code 2 votes vote down vote up
/**
 * Read the Object Id as a byte array.
 *
 * @param input the stream to read from.
 */
public static byte[] read(InputStream input)
{
  return OctetSeqHelper.read(input);
}
 
Example 36
Project: classpath   File: ObjectIdHelper.java   View source code 2 votes vote down vote up
/**
 * Write the Object Id as a byte array.
 *
 * @param output the stream to write into.
 * @param value the Object Id value to write.
 */
public static void write(OutputStream output, byte[] value)
{
  OctetSeqHelper.write(output, value);
}