/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { String } from "../../types/java/lang/String"; /** * Utility interface for encoding/decoding ("encode/decode" / "escape/unescape"). * *

* An instance of the Sitevision class implementing this interface can be obtained via * {@link senselogic.sitevision.api.Utils#getEndecUtil()}. * See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the Utils interface. *

* @author Magnus Lövgren */ export interface EndecUtil { /** * Escapes/encodes the characters in a String using XML entities. * *
   *    Example: "One <br /> & two" -> "One &lt;br /&gt; &amp; two"
   *  
* @param aString a String that needs to be escaped * @return aString escaped */ escapeXML(aString: String | string): string; /** * Unescapes/decodes a string containing basic XML entities to a string containing the actual Unicode characters corresponding to the entities. * *

* Supports the 5 basic XML entities (gt, lt, quot, amp, apos) and numerical unicodes (decimal and hex). *

* * Examples: *

* [ One &lt;br /&gt; &amp; two ] will become:
* [ One <br /> & two ] *

*

* [ &quot;Hej &aring; h&#229;&quot; &auml;r kopieringsskyddat&copy; s&#xE4;gs det ] will become:
* [ "Hej &aring; hå" &auml;r kopieringsskyddat&copy; sägs det ] *

* @param aString a String that contains escaped xml entities * @return aString unescaped * @see #unEscapeHTML4(String) */ unEscapeXML(aString: String | string): string; /** * Unescapes/decodes a string containing HTML 4 entities to a string containing the actual Unicode characters corresponding to the entities. * *

* Supports HTML 4.0 entities, including numerical unicodes (decimal and hex). *

* * Examples: *

* [ One &lt;br /&gt; &amp; two ] will become:
* [ One <br /> & two ] *

*

* [ &quot;Hej &aring; h&#229;&quot; &auml;r kopieringsskyddat&copy; s&#xE4;gs det ] will become:
* [ "Hej å hå" är kopieringsskyddat© sägs det ] *

* @param aString a String that contains escaped html 4 entities * @return aString unescaped * @see #unEscapeXML(String) * @since Sitevision 2.6.2 */ unEscapeHTML4(aString: String | string): string; /** * Encodes a String into its URL safe form using the default charset. *

* Handles the www-form-urlencoded encoding scheme, also misleadingly known as URL encoding *

* @param aURL the string to convert to a URL safe form * @return an URL safe String. Returns null if aURL is null or can't be encoded. * @since Sitevision 2.6.1_04 */ encodeURL(aURL: String | string): string; /** * Decodes a URL safe String into its original form using the default charset. *

* Handles the www-form-urlencoded encoding scheme, also misleadingly known as URL encoding *

* @param aURL URL safe String to convert to its original form * @return a decoded String. Returns null if aURL is null or can't be decoded. * @since Sitevision 2.6.1_04 */ decodeURL(aURL: String | string): string; /** * Converts line breaks to xhtml <br /> elements. * *
   *    Example: "Line 1\nLine 2" -> "Line 1<br />Line2"
   *  
* @param aString a String to convert * @return aString the converted string */ br(aString: String | string): string; /** * Replaces characters to their base subtitute. * A name that is base substituted ensures that the name is CSS valid. Can for instance be used to get valid names for anchors (anchor links). * *
   *    Example: "xml ëBå_$-1205" -> "xmleBa1205"
   *  
* @param aString a String that should be base substituted * @return the base substitute for aString */ getBaseSubstitute(aString: String | string): string; /** * Escapes/encodes a jcr name (property name or node name) that might contain illegal characters. * *

* Any operation that includes a JCR name that contains illegal characters must be escaped. For example: *

*

   *     javax.jcr.Node node = ...
   *
   *     javax.jcr.NodeIterator nodeIterator = node.getNodes("aNodeNameThatShouldBeEscaped");
   *     javax.jcr.NodeIterator anotherNodeIterator = node.getNodes("aNodeNameThatShouldBeEscaped/aNodeNameThatShouldBeEscaped");
   *     javax.jcr.Property property = node.getProperty("aPropertyNameThatShouldBeEscaped");
   *  
* *

* Characters in JCR Names - section 3.2.5.4 of the JSR 283 specification (Java Content Repository 2.0) *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Illegal characterSubstitution character
* (U+002A) "asterix"U+F02A
/ (U+002F) "slash"U+F02F
: (U+003A) "colon"U+F03A
[ (U+005B) "left bracket"U+F05B
] (U+005D) "right bracket"U+F05D
| (U+007C) "pipe"U+F07C
*

* Some specific names are conflicting with the JCR naming semantics and must also be escaped: *
(though, these two "dot-only" expressions would typically be extremely uncommon as names) *

* * * * * * * * * * * * * *
Illegal NameSubstitution Name
"." (the JCR Self Notation)U+F02E
".." (the JCR Parent Notation)U+F02E and U+F02E
* @param aJcrName a name that should be escaped/encoded * @return aJcrName escaped/encoded * @see #unEscapeJcrName(String) */ escapeJcrName(aJcrName: String | string): string; /** * Unescapes/decodes a jcr name (property name or node name) that might be escape/encoded. * *

* Any operation that includes getting a JCR name must be unescaped if it contains illegal characters. For example: *

*

   *     javax.jcr.Node node = ...
   *     javax.jcr.Property property = ...
   *
   *     java.lang.String aNameThatNeedsToBeUnEscaped = node.getName();
   *     java.lang.String anotherNameThatNeedsToBeUnEscaped = property.getName();
   *  
* *

* See {@link #escapeJcrName(String)} for escape/unescape characters and names *

* @param aJcrName a name that might be escaped/encoded * @return aJcrName unescaped/decoded * @see #escapeJcrName(String) */ unEscapeJcrName(aJcrName: String | string): string; /** * Encodes a string using base64 encoding (using UTF-8 encoding). * @param aString a String that should be base64 encoded * @return aString base64 encoded. Returns null if aString is null * @see #base64decode(String) * @since Sitevision 2.6 */ base64encode(aString: String | string): string; /** * Encodes a byte array to a base64 encoded string (using UTF-8 encoding). * @param aBytes a byte array that should be base64 encoded as string * @return aBytes as base64 encoded string, using UTF-8 encoding. Returns null if aBytes is null * @see #base64encode(String) * @since Sitevision 4.5.5.2 */ base64encodeToString(aBytes: unknown[]): string; /** * Decodes a base64 encoded string (using UTF-8 encoding). * @param aBase64EncodedString a base64 encoded String * @return aBase64EncodedString base64 decoded. Returns null if aBase64EncodedString is null or can't be decoded. * @see #base64encode(String) * @since Sitevision 2.6 */ base64decode(aBase64EncodedString: String | string): string; /** * Decodes a base64 encoded string to a byte array (using UTF-8 encoding). * @param aBase64EncodedString a base64 encoded String * @return aBase64EncodedString base64 decoded as byte array, using UTF-8 encoding. Returns null if aBase64EncodedString is null or can't be decoded. * @see #base64decode(String) * @since Sitevision 4.5.5.2 */ base64decodeToBytes(aBase64EncodedString: String | string): unknown; /** * Escapes/encodes an identifier. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Some examples
aPrefixanIdentifierReturned
nullnull""
""null""
null""""
""""""
"pcx"null"pcx"
null"pcx""pcx"
"pcx""""pcx"
"pcx""123""pcx123"
"pcx""1.23""pcx1_23"
"pcx""1.23.45""pcx1_23_45"
* @param aPrefix a prefix added to the result * @param anIdentifier a string id * @return a non-null prefixed and escaped string identifier * @see #unEscapeIdentifier(String, String) * @since Sitevision 3.0.2 */ escapeIdentifier( aPrefix: String | string, anIdentifier: String | string ): string; /** * Unescapes/decodes an escaped/encoded identifier. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Some examples
aPrefixanIdentifierReturned
nullnull""
""null""
null""""
""""""
"pcx"null""
null"pcx""pcx"
"pcx"""""
"pcx""pcx123""123"
"pcx""pcx1_23""1.23"
"pcx""pcx1_23_45""1.23.45"
null"pcx1_23""pcx1.23"
"""pcx1_23""pcx1.23"
"badprefix""pcx1_23""pcx1.23"
* @param aPrefix a prefix that will be removed from the result * @param anIdentifier a string id * @return an unescaped non-null identifier * @see #escapeIdentifier(String, String) * @since Sitevision 3.0.2 */ unEscapeIdentifier( aPrefix: String | string, anIdentifier: String | string ): string; } declare namespace EndecUtil {} declare var endecUtil: EndecUtil; export default endecUtil;