• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ByteHolder类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.omg.CORBA.ByteHolder的典型用法代码示例。如果您正苦于以下问题:Java ByteHolder类的具体用法?Java ByteHolder怎么用?Java ByteHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ByteHolder类属于org.omg.CORBA包,在下文中一共展示了ByteHolder类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: passSimple

点赞 3

import org.omg.CORBA.ByteHolder; //导入依赖的package包/类
/**
 * Accept and return parameters, having various types.
 */
public int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short,
                      StringHolder a_string, DoubleHolder a_double
                     )
{
  System.out.println("SERVER: ***** Test passing multiple parameters");
  System.out.println("SERVER:   Received:");
  System.out.println("SERVER:   octet " + an_octet.value);
  System.out.println("SERVER:   short " + a_short.value);
  System.out.println("SERVER:   string " + a_string.value);

  // Returning incremented values.
  an_octet.value++;
  a_short.value++;

  // OUT parameter, return only.
  a_double.value = 1;
  a_string.value += " [return]";
  return 452572;
}
 

开发者ID:vilie,
项目名称:javify,
代码行数:23,
代码来源:DemoServant.java

示例2: testParameters

点赞 3

import org.omg.CORBA.ByteHolder; //导入依赖的package包/类
/**
 * Test passing multiple parameters in both directions.
 */
public void testParameters()
{
  System.out.println("***** Pass multiple parameters.");

  // Holder classes are required to simulate passing
  // "by reference" (modification is returned back to the server).
  ByteHolder a_byte = new ByteHolder((byte) 0);
  ShortHolder a_short = new ShortHolder((short) 3);
  StringHolder a_string = new StringHolder("[string 4]");

  // This is an 'out' parameter; the value must not be passed to servant.
  DoubleHolder a_double = new DoubleHolder(56.789);

  int returned = object.passSimple(a_byte, 2, a_short, a_string, a_double);

  System.out.println("  Returned value " + returned);
  System.out.println("  Returned parameters: ");
  System.out.println("  octet " + a_byte.value);
  System.out.println("  short " + a_short.value);
  System.out.println("  string '" + a_string.value+"'");
  System.out.println("  double " + a_double.value);
}
 

开发者ID:vilie,
项目名称:javify,
代码行数:26,
代码来源:DirectTest.java

示例3: passSimple

点赞 2

import org.omg.CORBA.ByteHolder; //导入依赖的package包/类
/**
 * Passes various parameters in both directions. The parameters that
 * shoud also return the values are wrapped into holders.
 */
public int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short,
                      StringHolder a_string, DoubleHolder a_double
                     )
{
  InputStream in = null;
  try
    {
      // Get the stream where the parameters must be written:
      OutputStream out = _request("passSimple", true);

      // Write the parameters.
      out.write_octet(an_octet.value);
      out.write_long(a_long);
      out.write_short(a_short.value);
      out.write_string(a_string.value);

      // Invoke the method.
      in = _invoke(out);

      // Read the returned values.
      int result = in.read_long();

      // Read the inout and out parameters.
      an_octet.value = in.read_octet();
      a_short.value = in.read_short();
      a_string.value = in.read_string();
      a_double.value = in.read_double();
      return result;
    }
  catch (ApplicationException ex)
    {
      // Handle excepion on remote side.
      in = ex.getInputStream();
      throw new MARSHAL(ex.getId());
    }
  catch (RemarshalException _rm)
    {
      // Handle instruction to resend the parameters.
      return passSimple(an_octet, a_long, a_short, a_string, a_double);
    }
  finally
    {
      _releaseReply(in);
    }
}
 

开发者ID:vilie,
项目名称:javify,
代码行数:50,
代码来源:_DemoTesterStub.java

示例4: passSimple

点赞 1

import org.omg.CORBA.ByteHolder; //导入依赖的package包/类
/**
 * Passes various parameters in both directions.
 * The parameters that must return the value are wrapped in holders.
 */
int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short,
               StringHolder a_string, DoubleHolder a_double
              );
 

开发者ID:vilie,
项目名称:javify,
代码行数:8,
代码来源:DemoTester.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)