All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zeroc.IceMX.StringIntDictHelper Maven / Gradle / Ivy

//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
//
// Ice version 3.7.2
//
// 
//
// Generated from file `Metrics.ice'
//
// Warning: do not edit this file.
//
// 
//

package com.zeroc.IceMX;
/**
 * Helper class for marshaling/unmarshaling StringIntDict.
 **/

public final class StringIntDictHelper
{
    public static void write(com.zeroc.Ice.OutputStream ostr, java.util.Map v)
    {
        if(v == null)
        {
            ostr.writeSize(0);
        }
        else
        {
            ostr.writeSize(v.size());
            for(java.util.Map.Entry e : v.entrySet())
            {
                ostr.writeString(e.getKey());
                ostr.writeInt(e.getValue());
            }
        }
    }

    public static java.util.Map read(com.zeroc.Ice.InputStream istr)
    {
        java.util.Map v;
        v = new java.util.HashMap();
        int sz0 = istr.readSize();
        for(int i0 = 0; i0 < sz0; i0++)
        {
            String key;
            key = istr.readString();
            int value;
            value = istr.readInt();
            v.put(key, value);
        }
        return v;
    }

    public static void write(com.zeroc.Ice.OutputStream ostr, int tag, java.util.Optional> v)
    {
        if(v != null && v.isPresent())
        {
            write(ostr, tag, v.get());
        }
    }

    public static void write(com.zeroc.Ice.OutputStream ostr, int tag, java.util.Map v)
    {
        if(ostr.writeOptional(tag, com.zeroc.Ice.OptionalFormat.FSize))
        {
            int pos = ostr.startSize();
            StringIntDictHelper.write(ostr, v);
            ostr.endSize(pos);
        }
    }

    public static java.util.Optional> read(com.zeroc.Ice.InputStream istr, int tag)
    {
        if(istr.readOptional(tag, com.zeroc.Ice.OptionalFormat.FSize))
        {
            istr.skip(4);
            java.util.Map v;
            v = StringIntDictHelper.read(istr);
            return java.util.Optional.of(v);
        }
        else
        {
            return java.util.Optional.empty();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy