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

com.zeroc.Ice.ContextHelper Maven / Gradle / Ivy

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

package com.zeroc.Ice;
/**
 * Helper class for marshaling/unmarshaling Context.
 **/

public final class ContextHelper
{
    public static void write(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.writeString(e.getValue());
            }
        }
    }

    public static java.util.Map read(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();
            String value;
            value = istr.readString();
            v.put(key, value);
        }
        return v;
    }

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy