Package 

Class UrlBeaconUrlCompressor


  • 
    public class UrlBeaconUrlCompressor
    
                        

    Provides encoding / decoding functions for the URL beacon https://github.com/google/uribeacon

    • Method Summary

      Modifier and Type Method Description
      static Array<byte> compress(String urlString) Converts the given URL string into a byte array "compressed" version of the URL.
      static String uncompress(Array<byte> compressedURL)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • compress

         static Array<byte> compress(String urlString)

        Converts the given URL string into a byte array "compressed" version of the URL. The regex needs to determine what the URL starts with and what the hostname ends with. The URL must start with one of the following: http://www. https://www. http:// https:// The hostname may end with one of the following TLDs: .com .org .edu .net .info .biz .gov If the path component of the URL is non-empty, then the "slash" version of the matching TLD can be used. Otherwise, the "non-slash" version of the TLD is used. If the hostname doesn't end with a TLD, that's fine; it just isn't compressed into a single byte. Therefore, the following regex should tell me what I need to know about the URL: ^(http|https):\/\/(www.)?((?:[0-9a-z_-]+\.??)+)(\.[0-9a-z_-]+\/?)(.*)$ Groups: 1: http or https 2: www. or empty 3: hostname including optional leading www. but excluding trailing dot up to but not including TLD 4: TLD with leading dot and optional trailing slash 5: path without leading slash or empty