diff options
author | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2005-04-29 16:47:40 +0000 |
---|---|---|
committer | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2005-04-29 16:47:40 +0000 |
commit | ddeb4663884c7c06a0be469b7cdbe5d2a406f326 (patch) | |
tree | fb511e29e1ef03634c91e2df531027d7b9c9751d /org/omg/CORBA/AnySeqHelper.java | |
parent | eaf09eb247ee1d55001c27f086721f0110e8c2ee (diff) | |
download | classpath-ddeb4663884c7c06a0be469b7cdbe5d2a406f326.tar.gz |
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 <AudriusA@bluewin.ch>
* 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.
Diffstat (limited to 'org/omg/CORBA/AnySeqHelper.java')
-rw-r--r-- | org/omg/CORBA/AnySeqHelper.java | 20 |
1 files changed, 12 insertions, 8 deletions
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 <code>_write()</code> 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 ]); + } } } |