com.zeroc.Ice.HeaderDictHelper Maven / Gradle / Ivy
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
//
// Ice version 3.7.2
//
//
//
// Generated from file `Connection.ice'
//
// Warning: do not edit this file.
//
//
//
package com.zeroc.Ice;
/**
* Helper class for marshaling/unmarshaling HeaderDict.
**/
public final class HeaderDictHelper
{
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();
HeaderDictHelper.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 = HeaderDictHelper.read(istr);
return java.util.Optional.of(v);
}
else
{
return java.util.Optional.empty();
}
}
}