use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.
the class Localizer method writeExternal.
/**
* Writes the object to a stream.
*/
@Override
public void writeExternal(DataOutputStream dos) throws IOException {
ExtUtil.writeBool(dos, fallbackDefaultLocale);
ExtUtil.writeBool(dos, fallbackDefaultForm);
ExtUtil.write(dos, new ExtWrapMap(localeResources, new ExtWrapListPoly()));
ExtUtil.write(dos, new ExtWrapList(locales));
ExtUtil.write(dos, new ExtWrapNullable(defaultLocale));
ExtUtil.write(dos, new ExtWrapNullable(currentLocale));
}
use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.
the class Localizer method readExternal.
/* === (DE)SERIALIZATION === */
/**
* Reads the object from a stream.
*/
@Override
public void readExternal(DataInputStream dis, PrototypeFactory pf) throws IOException, DeserializationException {
fallbackDefaultLocale = ExtUtil.readBool(dis);
fallbackDefaultForm = ExtUtil.readBool(dis);
localeResources = (OrderedMap<String, List<LocaleDataSource>>) ExtUtil.read(dis, new ExtWrapMap(String.class, new ExtWrapListPoly(), ExtWrapMap.TYPE_ORDERED), pf);
locales = (List<String>) ExtUtil.read(dis, new ExtWrapList(String.class));
setDefaultLocale((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
String currentLocale = (String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf);
if (currentLocale != null) {
setLocale(currentLocale);
}
}
Aggregations