Class IRILib


  • public class IRILib
    extends java.lang.Object
    Operations 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.utilsURLEncodedUtils for 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 boolean containsNonASCII​(java.lang.String string)  
      static java.lang.String decodeHex​(java.lang.String string)
      Decode a string that may have %-encoded sequences.
      static java.lang.String encodeFileURL​(java.lang.String string)
      Encode using the rules for a file: URL.
      static java.lang.String encodeNonASCII​(java.lang.String string)  
      static java.lang.String encodeUriComponent​(java.lang.String string)
      Encode using the rules for a component (e.g.
      static java.lang.String encodeUriPath​(java.lang.String uri)
      Encode using the rules for a path (e.g.
      static java.lang.String encodeUriQueryFrag​(java.lang.String string)
      Encode using the rules for a query string or fragment (e.g.
      static java.lang.String filenameToIRI​(java.lang.String fn)
      Create a string that is a IRI for the filename.
      static java.lang.String fileToIRI​(java.io.File f)
      Return a string that is an IRI for the filename.
      static java.lang.String IRIToFilename​(java.lang.String iri)
      Convert a file: IRI to a filename
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IRILib

        public IRILib()
    • 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.