From ddeb4663884c7c06a0be469b7cdbe5d2a406f326 Mon Sep 17 00:00:00 2001 From: Audrius Meskauskas Date: Fri, 29 Apr 2005 16:47:40 +0000 Subject: The current version of helpers instantiates the additional holder object each time when the helper is used to read or write the data. The suggested path removes these instantiations. 2005-04-28 Audrius Meskauskas * org/omg/CORBA/WStringSeqHelper.java, org/omg/CORBA/AnySeqHelper.java, org/omg/CORBA/BooleanSeqHelper.java, org/omg/CORBA/CharSeqHelper.java, org/omg/CORBA/DoubleSeqHelper.java, org/omg/CORBA/FloatSeqHelper.java, org/omg/CORBA/LongLongSeqHelper.java, org/omg/CORBA/LongSeqHelper.java, org/omg/CORBA/OctetSeqHelper.java, org/omg/CORBA/ShortSeqHelper.java, org/omg/CORBA/StringSeqHelper.java, org/omg/CORBA/ULongLongSeqHelper.java, org/omg/CORBA/ULongSeqHelper.java, org/omg/CORBA/UShortSeqHelper.java, org/omg/CORBA/WCharSeqHelper.java: Removing redundant object instantiation. --- org/omg/CORBA/AnySeqHelper.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'org/omg/CORBA/AnySeqHelper.java') diff --git a/org/omg/CORBA/AnySeqHelper.java b/org/omg/CORBA/AnySeqHelper.java index 8a8fdf1bf..2165b7ab3 100644 --- a/org/omg/CORBA/AnySeqHelper.java +++ b/org/omg/CORBA/AnySeqHelper.java @@ -114,9 +114,12 @@ public abstract class AnySeqHelper */ public static Any[] read(InputStream input) { - AnySeqHolder h = new AnySeqHolder(); - h._read(input); - return h.value; + Any[] value = new Any[ input.read_long() ]; + for (int i = 0; i < value.length; i++) + { + value [ i ] = input.read_any(); + } + return value; } /** @@ -132,16 +135,17 @@ public abstract class AnySeqHelper /** * Writes the array of {@link Any}'s into the given stream. - * This implementation first creates an instance of - * {@link AnySeqHolder} and then delegates functionality - * to its _write() method. * * @param output the CORBA (not java.io) output stream to write. * @param value the value that must be written. */ public static void write(OutputStream output, Any[] value) { - AnySeqHolder h = new AnySeqHolder(value); - h._write(output); + output.write_long(value.length); + + for (int i = 0; i < value.length; i++) + { + output.write_any(value [ i ]); + } } } -- cgit v1.2.1