Package com.helger.xml.microdom.util
Class XMLMapHandler
- java.lang.Object
-
- com.helger.xml.microdom.util.XMLMapHandler
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_KEYAttribute name for key of a single mappingstatic StringATTR_VALUEAttribute name for value of a single mappingstatic StringELEMENT_MAPElement name for a single mappingstatic StringELEMENT_MAPPINGRoot element name
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IMicroDocumentcreateMapDocument(Map<String,String> aMap)static com.helger.commons.collection.impl.ICommonsMap<String,String>readMap(com.helger.commons.io.IHasInputStream aISP)static com.helger.commons.state.ESuccessreadMap(com.helger.commons.io.IHasInputStream aISP, Map<String,String> aTargetMap)static com.helger.commons.state.ESuccessreadMap(IMicroElement aParentElement, Map<String,String> aTargetMap)static com.helger.commons.collection.impl.ICommonsMap<String,String>readMap(InputStream aIS)Read a mapping from the passed input stream.static com.helger.commons.state.ESuccessreadMap(InputStream aIS, Map<String,String> aTargetMap)Read a mapping from the passed input stream.static com.helger.commons.state.ESuccesswriteMap(Map<String,String> aMap, com.helger.commons.io.IHasOutputStream aOSP)static com.helger.commons.state.ESuccesswriteMap(Map<String,String> aMap, OutputStream aOS)Write the passed map to the passed output stream using the predefined XML layout.
-
-
-
Field Detail
-
ELEMENT_MAPPING
public static final String ELEMENT_MAPPING
Root element name- See Also:
- Constant Field Values
-
ELEMENT_MAP
public static final String ELEMENT_MAP
Element name for a single mapping- See Also:
- Constant Field Values
-
ATTR_KEY
public static final String ATTR_KEY
Attribute name for key of a single mapping- See Also:
- Constant Field Values
-
ATTR_VALUE
public static final String ATTR_VALUE
Attribute name for value of a single mapping- See Also:
- Constant Field Values
-
-
Method Detail
-
readMap
@Nullable @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsMap<String,String> readMap(@Nonnull com.helger.commons.io.IHasInputStream aISP)
-
readMap
@Nonnull public static com.helger.commons.state.ESuccess readMap(@Nonnull com.helger.commons.io.IHasInputStream aISP, @Nonnull Map<String,String> aTargetMap)
-
readMap
@Nullable @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsMap<String,String> readMap(@Nonnull @WillClose InputStream aIS)
Read a mapping from the passed input stream.- Parameters:
aIS- The input stream to read from. May not benull.- Returns:
nullif reading the map failed
-
readMap
@Nonnull public static com.helger.commons.state.ESuccess readMap(@Nonnull @WillClose InputStream aIS, @Nonnull Map<String,String> aTargetMap)
Read a mapping from the passed input stream.- Parameters:
aIS- The input stream to read from. May not benull.aTargetMap- The target map to be filled.- Returns:
ESuccess.SUCCESSif the stream could be opened, if it could be read as XML and if the root element was correct.ESuccess.FAILUREotherwise.
-
readMap
@Nonnull public static com.helger.commons.state.ESuccess readMap(@Nonnull IMicroElement aParentElement, @Nonnull Map<String,String> aTargetMap)
-
createMapDocument
@Nonnull public static IMicroDocument createMapDocument(@Nonnull Map<String,String> aMap)
-
writeMap
@Nonnull public static com.helger.commons.state.ESuccess writeMap(@Nonnull Map<String,String> aMap, @Nonnull com.helger.commons.io.IHasOutputStream aOSP)
-
writeMap
@Nonnull public static com.helger.commons.state.ESuccess writeMap(@Nonnull Map<String,String> aMap, @Nonnull @WillClose OutputStream aOS)
Write the passed map to the passed output stream using the predefined XML layout.- Parameters:
aMap- The map to be written. May not benull.aOS- The output stream to write to. The stream is closed independent of success or failure. May not benull.- Returns:
ESuccess.SUCCESSwhen everything went well,ESuccess.FAILUREotherwise.
-
-