java类org.omg.CORBA.portable.Streamable的实例源码

Vio.java 文件源码 项目:javify 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Try to write value supposing that it implements self-streamable interfaces.
 * Return false if it does not or true on success.
 */
static boolean writeSelf(OutputStream output, Serializable value)
{
  // User defined write method is present.
  if (value instanceof CustomMarshal)
    {
      ((CustomMarshal) value).marshal((DataOutputStream) output);
      return true;
    }
  else if (value instanceof Streamable)
    {
      ((Streamable) value)._write(output);
      return true;
    }
  return false;
}
Vio.java 文件源码 项目:jvm-stm 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Try to write value supposing that it implements self-streamable interfaces.
 * Return false if it does not or true on success.
 */
static boolean writeSelf(OutputStream output, Serializable value)
{
  // User defined write method is present.
  if (value instanceof CustomMarshal)
    {
      ((CustomMarshal) value).marshal((DataOutputStream) output);
      return true;
    }
  else if (value instanceof Streamable)
    {
      ((Streamable) value)._write(output);
      return true;
    }
  return false;
}
Vio.java 文件源码 项目:JamVM-PH 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Try to write value supposing that it implements self-streamable interfaces.
 * Return false if it does not or true on success.
 */
static boolean writeSelf(OutputStream output, Serializable value)
{
  // User defined write method is present.
  if (value instanceof CustomMarshal)
    {
      ((CustomMarshal) value).marshal((DataOutputStream) output);
      return true;
    }
  else if (value instanceof Streamable)
    {
      ((Streamable) value)._write(output);
      return true;
    }
  return false;
}
Vio.java 文件源码 项目:classpath 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Try to write value supposing that it implements self-streamable interfaces.
 * Return false if it does not or true on success.
 */
static boolean writeSelf(OutputStream output, Serializable value)
{
  // User defined write method is present.
  if (value instanceof CustomMarshal)
    {
      ((CustomMarshal) value).marshal((DataOutputStream) output);
      return true;
    }
  else if (value instanceof Streamable)
    {
      ((Streamable) value)._write(output);
      return true;
    }
  return false;
}
DynUnionImpl.java 文件源码 项目:TIDorbJ 阅读 21 收藏 0 点赞 0 评论 0
public void _write(org.omg.CORBA.portable.OutputStream out)
{
    if (m_destroyed)
        throw new OBJECT_NOT_EXIST("DynAny destroyed", 0,
                                   CompletionStatus.COMPLETED_NO);

    if (m_component_count == 1)
        throw new BAD_OPERATION("Uncompleted union.");

    try {
        ((Streamable) get_discriminator())._write(out);
        ((Streamable) member())._write(out);
    }
    catch (InvalidValue iv) {
        throw new INTERNAL(iv.toString());
    }
}
AnyImpl.java 文件源码 项目:OpenJSharp 阅读 20 收藏 0 点赞 0 评论 0
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
AnyImpl.java 文件源码 项目:openjdk-jdk10 阅读 24 收藏 0 点赞 0 评论 0
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
AnyImpl.java 文件源码 项目:openjdk9 阅读 35 收藏 0 点赞 0 评论 0
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
AnyImpl.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 20 收藏 0 点赞 0 评论 0
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
AnyImpl.java 文件源码 项目:jdk8u_corba 阅读 24 收藏 0 点赞 0 评论 0
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
_BindingIteratorImplBase.java 文件源码 项目:javify 阅读 20 收藏 0 点赞 0 评论 0
/**
 * The obsolete invocation using server request. Implemented for
 * compatibility reasons, but is it more effectinve to use
 * {@link #_invoke}.
 *
 * @param request a server request.
 */
public void invoke(ServerRequest request)
{
  // "destroy" has a void return type, the two other methods - boolean.
  Streamable result =
    request.operation().equals("destroy") ? null : new BooleanHolder();
  gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result);
}
RecordAny.java 文件源码 项目:javify 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Done via reflection.
 */
public Any to_any()
{
  try
    {
      Streamable sHolder = HolderLocator.createHolder(official_type);

      Class sHolderClass = sHolder.getClass();
      Field sHolderValue = sHolderClass.getField("value");
      Class sClass = sHolderValue.getType();

      Object structure = sClass.newInstance();
      Object member;
      Any am;
      Field vread;
      Field vwrite;
      Streamable memberHolder;

      for (int i = 0; i < array.length; i++)
        {
          am = array [ i ].to_any();
          memberHolder = am.extract_Streamable();
          vwrite = structure.getClass().getField(final_type.member_name(i));
          vread = memberHolder.getClass().getField("value");
          member = vread.get(memberHolder);
          vwrite.set(structure, member);
        }

      Any g = createAny();
      sHolderValue.set(sHolder, structure);
      g.insert_Streamable(sHolder);
      g.type(official_type);
      return g;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
}
gnuDynAny.java 文件源码 项目:javify 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Create DynAny providing the holder.
 *
 * @param a_holder
 */
public gnuDynAny(Streamable aHolder, TypeCode oType, TypeCode aType,
  gnuDynAnyFactory aFactory, ORB anOrb
)
{
  super(oType, aType, aFactory, anOrb);
  holder = aHolder;
}
gnuDynAny.java 文件源码 项目:javify 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Create a copy of this {@link DynAny} via buffer read/write.
 */
public DynAny copy()
{
  if (holder != null)
    {
      BufferedCdrOutput buffer = new BufferedCdrOutput();
      holder._write(buffer);

      gnuDynAny other;
      try
        {
          other =
            new gnuDynAny((Streamable) (holder.getClass().newInstance()),
              official_type, final_type, factory, orb
            );
        }
      catch (Exception e)
        {
          // Holder must have parameterless constructor.
          throw new Unexpected(e);
        }
      other.holder._read(buffer.create_input_stream());
      return other;
    }
  else
    {
      return new gnuDynAny(null, official_type, final_type, factory, orb);
    }
}
gnuDynValueBox.java 文件源码 项目:javify 阅读 23 收藏 0 点赞 0 评论 0
/** @inheritDoc */
public void from_any(Any an_any)
              throws TypeMismatch, InvalidValue
{
  checkType(official_type, an_any.type());
  try
    {
      if (!an_any.type().content_type().equal(content))
        throw new InvalidValue(CONTENT);
    }
  catch (BadKind e)
    {
      TypeMismatch t = new TypeMismatch("Not a box");
      t.initCause(e);
      throw t;
    }

  Serializable s = an_any.extract_Value();
  if (s == null)
    set_to_null();
  else
    {
      try
        {
          Streamable holder = HolderLocator.createHolder(content);
          Field v = holder.getClass().getField("value");
          v.set(holder, s);

          Any cont = createAny();
          cont.insert_Streamable(holder);

          array = new DynAny[] { factory.create_dyn_any(cont) };
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  valueChanged();
}
gnuDynValueBox.java 文件源码 项目:javify 阅读 26 收藏 0 点赞 0 评论 0
/** @inheritDoc */
public Any to_any()
{
  Any a = createAny();

  if (!is_null())
    {
      try
        {
          Streamable holder;
          if (array [ 0 ] instanceof gnuDynAny)
            holder = ((gnuDynAny) array [ 0 ]).holder;
          else
            {
              Any uan = array [ 0 ].to_any();
              holder = uan.extract_Streamable();
            }

          Field v = holder.getClass().getField("value");
          Serializable value = (Serializable) v.get(holder);
          a.type(official_type);
          a.insert_Value(value, content);
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  else
    a.type(orb.get_primitive_tc(TCKind.tk_null));
  return a;
}
AbstractCdrOutput.java 文件源码 项目:javify 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Writes an instance of the CORBA {@link Any}.
 * This method writes the typecode, followed
 * by value itself. In Any contains null
 * (value not set), the {@link TCKind#tk_null}
 * is written.
 *
 * @param x the {@link Any} to write.
 */
public void write_any(Any x)
{
  Streamable value = x.extract_Streamable();
  if (value != null)
    {
      write_TypeCode(x.type());
      value._write(this);
    }
  else
    {
      PrimitiveTypeCode p = new PrimitiveTypeCode(TCKind.tk_null);
      write_TypeCode(p);
    }
}
_BindingIteratorImplBase.java 文件源码 项目:jvm-stm 阅读 19 收藏 0 点赞 0 评论 0
/**
 * The obsolete invocation using server request. Implemented for
 * compatibility reasons, but is it more effectinve to use
 * {@link #_invoke}.
 *
 * @param request a server request.
 */
public void invoke(ServerRequest request)
{
  // "destroy" has a void return type, the two other methods - boolean.
  Streamable result =
    request.operation().equals("destroy") ? null : new BooleanHolder();
  gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result);
}
RecordAny.java 文件源码 项目:jvm-stm 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Done via reflection.
 */
public Any to_any()
{
  try
    {
      Streamable sHolder = HolderLocator.createHolder(official_type);

      Class sHolderClass = sHolder.getClass();
      Field sHolderValue = sHolderClass.getField("value");
      Class sClass = sHolderValue.getType();

      Object structure = sClass.newInstance();
      Object member;
      Any am;
      Field vread;
      Field vwrite;
      Streamable memberHolder;

      for (int i = 0; i < array.length; i++)
        {
          am = array [ i ].to_any();
          memberHolder = am.extract_Streamable();
          vwrite = structure.getClass().getField(final_type.member_name(i));
          vread = memberHolder.getClass().getField("value");
          member = vread.get(memberHolder);
          vwrite.set(structure, member);
        }

      Any g = createAny();
      sHolderValue.set(sHolder, structure);
      g.insert_Streamable(sHolder);
      g.type(official_type);
      return g;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
}
gnuDynAny.java 文件源码 项目:jvm-stm 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Create DynAny providing the holder.
 *
 * @param a_holder
 */
public gnuDynAny(Streamable aHolder, TypeCode oType, TypeCode aType,
  gnuDynAnyFactory aFactory, ORB anOrb
)
{
  super(oType, aType, aFactory, anOrb);
  holder = aHolder;
}
gnuDynAny.java 文件源码 项目:jvm-stm 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Create a copy of this {@link DynAny} via buffer read/write.
 */
public DynAny copy()
{
  if (holder != null)
    {
      BufferedCdrOutput buffer = new BufferedCdrOutput();
      holder._write(buffer);

      gnuDynAny other;
      try
        {
          other =
            new gnuDynAny((Streamable) (holder.getClass().newInstance()),
              official_type, final_type, factory, orb
            );
        }
      catch (Exception e)
        {
          // Holder must have parameterless constructor.
          throw new Unexpected(e);
        }
      other.holder._read(buffer.create_input_stream());
      return other;
    }
  else
    {
      return new gnuDynAny(null, official_type, final_type, factory, orb);
    }
}
gnuDynValueBox.java 文件源码 项目:jvm-stm 阅读 22 收藏 0 点赞 0 评论 0
/** @inheritDoc */
public void from_any(Any an_any)
              throws TypeMismatch, InvalidValue
{
  checkType(official_type, an_any.type());
  try
    {
      if (!an_any.type().content_type().equal(content))
        throw new InvalidValue(CONTENT);
    }
  catch (BadKind e)
    {
      TypeMismatch t = new TypeMismatch("Not a box");
      t.initCause(e);
      throw t;
    }

  Serializable s = an_any.extract_Value();
  if (s == null)
    set_to_null();
  else
    {
      try
        {
          Streamable holder = HolderLocator.createHolder(content);
          Field v = holder.getClass().getField("value");
          v.set(holder, s);

          Any cont = createAny();
          cont.insert_Streamable(holder);

          array = new DynAny[] { factory.create_dyn_any(cont) };
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  valueChanged();
}
gnuDynValueBox.java 文件源码 项目:jvm-stm 阅读 23 收藏 0 点赞 0 评论 0
/** @inheritDoc */
public Any to_any()
{
  Any a = createAny();

  if (!is_null())
    {
      try
        {
          Streamable holder;
          if (array [ 0 ] instanceof gnuDynAny)
            holder = ((gnuDynAny) array [ 0 ]).holder;
          else
            {
              Any uan = array [ 0 ].to_any();
              holder = uan.extract_Streamable();
            }

          Field v = holder.getClass().getField("value");
          Serializable value = (Serializable) v.get(holder);
          a.type(official_type);
          a.insert_Value(value, content);
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  else
    a.type(orb.get_primitive_tc(TCKind.tk_null));
  return a;
}
AbstractCdrOutput.java 文件源码 项目:jvm-stm 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Writes an instance of the CORBA {@link Any}.
 * This method writes the typecode, followed
 * by value itself. In Any contains null
 * (value not set), the {@link TCKind#tk_null}
 * is written.
 *
 * @param x the {@link Any} to write.
 */
public void write_any(Any x)
{
  Streamable value = x.extract_Streamable();
  if (value != null)
    {
      write_TypeCode(x.type());
      value._write(this);
    }
  else
    {
      PrimitiveTypeCode p = new PrimitiveTypeCode(TCKind.tk_null);
      write_TypeCode(p);
    }
}
Test75.java 文件源码 项目:giv-planner 阅读 21 收藏 0 点赞 0 评论 0
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s        the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
//debug.log ("insert_Streamable");
typeCode = TypeCodeImpl.convertToNative(orb, s._type());
object = s;
isInitialized = true;
}
AnyImpl.java 文件源码 项目:infobip-open-jdk-8 阅读 26 收藏 0 点赞 0 评论 0
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
AnyImpl.java 文件源码 项目:openjdk-source-code-learn 阅读 22 收藏 0 点赞 0 评论 0
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
AnyImpl.java 文件源码 项目:OLD-OpenJDK8 阅读 25 收藏 0 点赞 0 评论 0
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
_BindingIteratorImplBase.java 文件源码 项目:JamVM-PH 阅读 20 收藏 0 点赞 0 评论 0
/**
 * The obsolete invocation using server request. Implemented for
 * compatibility reasons, but is it more effectinve to use
 * {@link #_invoke}.
 *
 * @param request a server request.
 */
public void invoke(ServerRequest request)
{
  // "destroy" has a void return type, the two other methods - boolean.
  Streamable result =
    request.operation().equals("destroy") ? null : new BooleanHolder();
  gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result);
}
RecordAny.java 文件源码 项目:JamVM-PH 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Done via reflection.
 */
public Any to_any()
{
  try
    {
      Streamable sHolder = HolderLocator.createHolder(official_type);

      Class sHolderClass = sHolder.getClass();
      Field sHolderValue = sHolderClass.getField("value");
      Class sClass = sHolderValue.getType();

      Object structure = sClass.newInstance();
      Object member;
      Any am;
      Field vread;
      Field vwrite;
      Streamable memberHolder;

      for (int i = 0; i < array.length; i++)
        {
          am = array [ i ].to_any();
          memberHolder = am.extract_Streamable();
          vwrite = structure.getClass().getField(final_type.member_name(i));
          vread = memberHolder.getClass().getField("value");
          member = vread.get(memberHolder);
          vwrite.set(structure, member);
        }

      Any g = createAny();
      sHolderValue.set(sHolder, structure);
      g.insert_Streamable(sHolder);
      g.type(official_type);
      return g;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号