Package com.helger.xml.serialize.write
Class XMLMaskHelper
- java.lang.Object
-
- com.helger.xml.serialize.write.XMLMaskHelper
-
public final class XMLMaskHelper extends Object
This class contains all the methods for masking XML content.- Author:
- Philip Helger
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static char[]getAsCharArray(Set<Character> aChars)Convert the passed set to an arraystatic StringgetHTMLEntityReferenceString(char c)Get the entity reference for the specified character.static char[]getMaskedXMLText(EXMLSerializeVersion eXMLVersion, EXMLCharMode eXMLCharMode, EXMLIncorrectCharacterHandling eIncorrectCharHandling, String s)static intgetMaskedXMLTextLength(EXMLVersion eXMLVersion, EXMLCharMode eXMLCharMode, EXMLIncorrectCharacterHandling eIncorrectCharHandling, String s)static intgetMaskedXMLTextLength(EXMLSerializeVersion eXMLVersion, EXMLCharMode eXMLCharMode, EXMLIncorrectCharacterHandling eIncorrectCharHandling, String s)static StringgetXML10EntityReferenceString(char c)Get the entity reference for the specified character.static StringgetXML11EntityReferenceString(char c)Get the entity reference for the specified character.static StringgetXMLNumericReference(char n)static voidmaskXMLTextTo(EXMLSerializeVersion eXMLVersion, EXMLCharMode eXMLCharMode, EXMLIncorrectCharacterHandling eIncorrectCharHandling, char[] aText, int nOfs, int nLen, Writer aWriter)static voidmaskXMLTextTo(EXMLSerializeVersion eXMLVersion, EXMLCharMode eXMLCharMode, EXMLIncorrectCharacterHandling eIncorrectCharHandling, String s, Writer aWriter)
-
-
-
Method Detail
-
getXML10EntityReferenceString
@Nonnull @Nonempty public static String getXML10EntityReferenceString(char c)
Get the entity reference for the specified character. This returns e.g. < for '<' etc. This method has special handling for <, >, &, " and '. All other chars are encoded by their numeric value (e.g. È)- Parameters:
c- Character to use.- Returns:
- The entity reference string. Never
nullnor empty.
-
getXML11EntityReferenceString
@Nonnull @Nonempty public static String getXML11EntityReferenceString(char c)
Get the entity reference for the specified character. This returns e.g. < for '<' etc. This method has special handling for <, >, &, " and '. All other chars are encoded by their numeric value (e.g. È)- Parameters:
c- Character to use.- Returns:
- The entity reference string. Never
nullnor empty.
-
getHTMLEntityReferenceString
@Nonnull @Nonempty public static String getHTMLEntityReferenceString(char c)
Get the entity reference for the specified character. This returns e.g.<for '<' etc. This method has special handling for <, >, & and ". All other chars are encoded by their numeric value (e.g.È). In contrast togetXML10EntityReferenceString(char)this method does not handle'- Parameters:
c- Character to use.- Returns:
- The entity reference string. Never
nullnor empty.
-
getAsCharArray
@Nonnull @ReturnsMutableCopy public static char[] getAsCharArray(@Nonnull Set<Character> aChars)
Convert the passed set to an array- Parameters:
aChars- Character set to use. May not benull.- Returns:
- A new array with the same length as the source set.
-
getMaskedXMLText
@Nonnull public static char[] getMaskedXMLText(@Nonnull EXMLSerializeVersion eXMLVersion, @Nonnull EXMLCharMode eXMLCharMode, @Nonnull EXMLIncorrectCharacterHandling eIncorrectCharHandling, @Nullable String s)
-
getMaskedXMLTextLength
@Nonnegative public static int getMaskedXMLTextLength(@Nonnull EXMLVersion eXMLVersion, @Nonnull EXMLCharMode eXMLCharMode, @Nonnull EXMLIncorrectCharacterHandling eIncorrectCharHandling, @Nullable String s)
-
getMaskedXMLTextLength
@Nonnegative public static int getMaskedXMLTextLength(@Nonnull EXMLSerializeVersion eXMLVersion, @Nonnull EXMLCharMode eXMLCharMode, @Nonnull EXMLIncorrectCharacterHandling eIncorrectCharHandling, @Nullable String s)
-
maskXMLTextTo
public static void maskXMLTextTo(@Nonnull EXMLSerializeVersion eXMLVersion, @Nonnull EXMLCharMode eXMLCharMode, @Nonnull EXMLIncorrectCharacterHandling eIncorrectCharHandling, @Nullable String s, @Nonnull Writer aWriter) throws IOException
- Throws:
IOException
-
maskXMLTextTo
public static void maskXMLTextTo(@Nonnull EXMLSerializeVersion eXMLVersion, @Nonnull EXMLCharMode eXMLCharMode, @Nonnull EXMLIncorrectCharacterHandling eIncorrectCharHandling, @Nonnull char[] aText, @Nonnegative int nOfs, @Nonnegative int nLen, @Nonnull Writer aWriter) throws IOException
- Throws:
IOException
-
-