Class UrlUtil

java.lang.Object
com.itextpdf.io.util.UrlUtil

public final class UrlUtil extends Object
This file is a helper class for internal usage only. Be aware that its API and functionality may be changed in future.
  • Constructor Details

    • UrlUtil

      private UrlUtil()
  • Method Details

    • toURL

      public static URL toURL(String filename) throws MalformedURLException
      This method makes a valid URL from a given filename.

      This method makes the conversion of this library from the JAVA 2 platform to a JDK1.1.x-version easier.

      Parameters:
      filename - a given filename
      Returns:
      a valid URL
      Throws:
      MalformedURLException
    • toNormalizedURI

      public static URI toNormalizedURI(String filename)
      This method makes a normalized URI from a given filename.
      Parameters:
      filename - a given filename
      Returns:
      a valid URI
    • toNormalizedURI

      public static URI toNormalizedURI(File file)
      This method makes a normalized URI from a given file.
      Parameters:
      file - a given filename
      Returns:
      a valid URI
    • openStream

      public static InputStream openStream(URL url) throws IOException
      Throws:
      IOException
    • getFileUriString

      public static String getFileUriString(String filename) throws MalformedURLException
      This method gets uri string from a file.
      Parameters:
      filename - a given filename
      Returns:
      a uri string
      Throws:
      MalformedURLException
    • getNormalizedFileUriString

      public static String getNormalizedFileUriString(String filename)
      This method gets normalized uri string from a file.
      Parameters:
      filename - a given filename
      Returns:
      a normalized uri string
    • getInputStreamOfFinalConnection

      public static InputStream getInputStreamOfFinalConnection(URL initialUrl) throws IOException
      Gets the input stream of connection related to last redirected url. You should manually close input stream after calling this method to not hold any open resources.
      Parameters:
      initialUrl - an initial URL.
      Returns:
      an input stream of connection related to the last redirected url.
      Throws:
      IOException - signals that an I/O exception has occurred.
    • getFinalConnection

      static URLConnection getFinalConnection(URL initialUrl) throws IOException
      Gets the connection related to the last redirected url. You should close connection manually after calling this method, to not hold any open resources.
      Parameters:
      initialUrl - an initial URL.
      Returns:
      connection related to the last redirected url.
      Throws:
      IOException - signals that an I/O exception has occurred.