src/share/classes/org/omg/CORBA/LongHolder.java

changeset 1
55540e827aef
child 158
91006f157c46
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/classes/org/omg/CORBA/LongHolder.java	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,108 @@
     1.4 +/*
     1.5 + * Copyright 1995-2001 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Sun designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Sun in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.26 + * have any questions.
    1.27 + */
    1.28 +
    1.29 +package org.omg.CORBA;
    1.30 +
    1.31 +import org.omg.CORBA.portable.Streamable;
    1.32 +import org.omg.CORBA.portable.InputStream;
    1.33 +import org.omg.CORBA.portable.OutputStream;
    1.34 +
    1.35 +/**
    1.36 + * The Holder for <tt>Long</tt>.  For more information on
    1.37 + * Holder files, see <a href="doc-files/generatedfiles.html#holder">
    1.38 + * "Generated Files: Holder Files"</a>.<P>
    1.39 + * A Holder class for a <code>long</code>
    1.40 + * that is used to store "out" and "inout" parameters in IDL methods.
    1.41 + * If an IDL method signature has an IDL <code>long long</code> as an "out"
    1.42 + * or "inout" parameter, the programmer must pass an instance of
    1.43 + * <code>LongHolder</code> as the corresponding
    1.44 + * parameter in the method invocation; for "inout" parameters, the programmer
    1.45 + * must also fill the "in" value to be sent to the server.
    1.46 + * Before the method invocation returns, the ORB will fill in the
    1.47 + * value corresponding to the "out" value returned from the server.
    1.48 + * <P>
    1.49 + * If <code>myLongHolder</code> is an instance of <code>LongHolder</code>,
    1.50 + * the value stored in its <code>value</code> field can be accessed with
    1.51 + * <code>myLongHolder.value</code>.
    1.52 + *
    1.53 + * @since       JDK1.2
    1.54 + */
    1.55 +public final class LongHolder implements Streamable {
    1.56 +
    1.57 +    /**
    1.58 +     * The <code>long</code> value held by this <code>LongHolder</code>
    1.59 +     * object.
    1.60 +     */
    1.61 +    public long value;
    1.62 +
    1.63 +    /**
    1.64 +     * Constructs a new <code>LongHolder</code> object with its
    1.65 +     * <code>value</code> field initialized to <code>0</code>.
    1.66 +     */
    1.67 +    public LongHolder() {
    1.68 +    }
    1.69 +
    1.70 +    /**
    1.71 +     * Constructs a new <code>LongHolder</code> object with its
    1.72 +     * <code>value</code> field initialized to the given
    1.73 +     * <code>long</code>.
    1.74 +     * @param initial the <code>long</code> with which to initialize
    1.75 +     *                the <code>value</code> field of the newly-created
    1.76 +     *                <code>LongHolder</code> object
    1.77 +     */
    1.78 +    public LongHolder(long initial) {
    1.79 +        value = initial;
    1.80 +    }
    1.81 +
    1.82 +    /**
    1.83 +     * Reads from <code>input</code> and initalizes the value in the Holder
    1.84 +     * with the unmarshalled data.
    1.85 +     *
    1.86 +     * @param input the InputStream containing CDR formatted data from the wire
    1.87 +     */
    1.88 +    public void _read(InputStream input) {
    1.89 +        value = input.read_longlong();
    1.90 +    }
    1.91 +
    1.92 +    /**
    1.93 +     * Marshals to <code>output</code> the value in the Holder.
    1.94 +     *
    1.95 +     * @param output the OutputStream which will contain the CDR formatted data
    1.96 +     */
    1.97 +    public void _write(OutputStream output) {
    1.98 +        output.write_longlong(value);
    1.99 +    }
   1.100 +
   1.101 +    /**
   1.102 +     * Returns the <code>TypeCode</code> object
   1.103 +     * corresponding to the value held in the Holder.
   1.104 +     *
   1.105 +     * @return    the TypeCode of the value held in the holder
   1.106 +     */
   1.107 +    public org.omg.CORBA.TypeCode _type() {
   1.108 +        return ORB.init().get_primitive_tc(TCKind.tk_longlong);
   1.109 +    }
   1.110 +
   1.111 +}

mercurial