Package org.apache.jena.atlas.lib
Class IRILib
- java.lang.Object
-
- org.apache.jena.atlas.lib.IRILib
-
public class IRILib extends java.lang.ObjectOperations related to IRIs.The encoding operations are for Linked Data use, not network encoding - e.g. use URLEncoder.encode(java.lang.String) or
org.apache.http.client.utilsURLEncodedUtilsfor encoding query string name/value pairs for the network.
-
-
Constructor Summary
Constructors Constructor Description IRILib()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancontainsNonASCII(java.lang.String string)static java.lang.StringdecodeHex(java.lang.String string)Decode a string that may have %-encoded sequences.static java.lang.StringencodeFileURL(java.lang.String string)Encode using the rules for a file: URL.static java.lang.StringencodeNonASCII(java.lang.String string)static java.lang.StringencodeUriComponent(java.lang.String string)Encode using the rules for a component (e.g.static java.lang.StringencodeUriPath(java.lang.String uri)Encode using the rules for a path (e.g.static java.lang.StringencodeUriQueryFrag(java.lang.String string)Encode using the rules for a query string or fragment (e.g.static java.lang.StringfilenameToIRI(java.lang.String fn)Create a string that is a IRI for the filename.static java.lang.StringfileToIRI(java.io.File f)Return a string that is an IRI for the filename.static java.lang.StringIRIToFilename(java.lang.String iri)Convert a file: IRI to a filename
-
-
-
Method Detail
-
fileToIRI
public static java.lang.String fileToIRI(java.io.File f)
Return a string that is an IRI for the filename.
-
filenameToIRI
public static java.lang.String filenameToIRI(java.lang.String fn)
Create a string that is a IRI for the filename.- The file name may already have
file:.- The file name may be relative.
- Encode using the rules for a path (e.g. ':' and'/' do not get encoded)
- Non-IRI characters get %-encoded.
- The file name may already have
-
IRIToFilename
public static java.lang.String IRIToFilename(java.lang.String iri)
Convert a file: IRI to a filename
-
encodeUriComponent
public static java.lang.String encodeUriComponent(java.lang.String string)
Encode using the rules for a component (e.g. ':' and '/' get encoded) Apply to a name/value of a query string. Does not encode non-ASCII characters
-
encodeUriQueryFrag
public static java.lang.String encodeUriQueryFrag(java.lang.String string)
Encode using the rules for a query string or fragment (e.g. ':' and '/' do not encoded). It does not encode non-ASCII characters. '?' is not encoded - in RFC 3986, the first '?' triggers the query part but it is then a legal, character.
-
encodeFileURL
public static java.lang.String encodeFileURL(java.lang.String string)
Encode using the rules for a file: URL. Does not encode non-ASCII characters
-
encodeUriPath
public static java.lang.String encodeUriPath(java.lang.String uri)
Encode using the rules for a path (e.g. ':' and '/' do not get encoded)
-
encodeNonASCII
public static java.lang.String encodeNonASCII(java.lang.String string)
-
containsNonASCII
public static boolean containsNonASCII(java.lang.String string)
-
decodeHex
public static java.lang.String decodeHex(java.lang.String string)
Decode a string that may have %-encoded sequences.This function will reverse
encodeNonASCII(String),encodeUriPath(String),encodeFileURL(String)andencodeUriComponent(String). It will not decode '+' used for space (application/x-www-form-urlencoded).
-
-