1. /*
  2. * @(#)NameHelper.java 1.10 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. /*
  11. * File: ./org/omg/CosNaming/NameHelper.java
  12. * From: nameservice.idl
  13. * Date: Tue Aug 11 03:12:09 1998
  14. * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
  15. */
  16. package org.omg.CosNaming;
  17. public class NameHelper {
  18. // It is useless to have instances of this class
  19. private NameHelper() { }
  20. public static void write(org.omg.CORBA.portable.OutputStream out, org.omg.CosNaming.NameComponent[] that) {
  21. {
  22. out.write_long(that.length);
  23. for (int __index = 0 ; __index < that.length ; __index += 1) {
  24. org.omg.CosNaming.NameComponentHelper.write(out, that[__index]);
  25. }
  26. }
  27. }
  28. public static org.omg.CosNaming.NameComponent[] read(org.omg.CORBA.portable.InputStream in) {
  29. org.omg.CosNaming.NameComponent[] that;
  30. {
  31. int __length = in.read_long();
  32. that = new org.omg.CosNaming.NameComponent[__length];
  33. for (int __index = 0 ; __index < that.length ; __index += 1) {
  34. that[__index] = org.omg.CosNaming.NameComponentHelper.read(in);
  35. }
  36. }
  37. return that;
  38. }
  39. public static org.omg.CosNaming.NameComponent[] extract(org.omg.CORBA.Any a) {
  40. org.omg.CORBA.portable.InputStream in = a.create_input_stream();
  41. return read(in);
  42. }
  43. public static void insert(org.omg.CORBA.Any a, org.omg.CosNaming.NameComponent[] that) {
  44. org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
  45. a.type(type());
  46. write(out, that);
  47. a.read_value(out.create_input_stream(), type());
  48. }
  49. private static org.omg.CORBA.TypeCode _tc;
  50. synchronized public static org.omg.CORBA.TypeCode type() {
  51. if (_tc == null)
  52. _tc = org.omg.CORBA.ORB.init().create_alias_tc(id(), "Name", org.omg.CORBA.ORB.init().create_sequence_tc(0, org.omg.CosNaming.NameComponentHelper.type()));
  53. return _tc;
  54. }
  55. public static String id() {
  56. return "IDL:omg.org/CosNaming/Name:1.0";
  57. }
  58. }