Class UrlUtil
java.lang.Object
com.itextpdf.io.util.UrlUtil
This file is a helper class for internal usage only.
Be aware that its API and functionality may be changed in future.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetFileUriString(String filename) This method gets uri string from a file.static InputStreamgetInputStreamOfFinalConnection(URL initialUrl) Gets the input stream of connection related to last redirected url.static InputStreamgetInputStreamOfFinalConnection(URL initialUrl, int connectTimeout, int readTimeout) Gets the input stream of connection related to last redirected url.static StringgetNormalizedFileUriString(String filename) This method gets normalized uri string from a file.static InputStreamopenStream(URL url) static StringtoAbsoluteURI(URI uri) Get the entire URI string which is properly encoded.static URItoNormalizedURI(File file) This method makes a normalized URI from a given file.static URItoNormalizedURI(String filename) This method makes a normalized URI from a given filename.static URLThis method makes a valid URL from a given filename.
-
Method Details
-
toURL
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- If a protocol handler for the URL could not be found, or if some other error occurred while constructing the URL
-
toNormalizedURI
-
toNormalizedURI
-
toAbsoluteURI
-
openStream
- Throws:
IOException
-
getFileUriString
This method gets uri string from a file.- Parameters:
filename- a given filename- Returns:
- a uri string
- Throws:
MalformedURLException- If a protocol handler for the URL could not be found, or if some other error occurred while constructing the URL
-
getNormalizedFileUriString
-
getInputStreamOfFinalConnection
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.
-
getInputStreamOfFinalConnection
public static InputStream getInputStreamOfFinalConnection(URL initialUrl, int connectTimeout, int readTimeout) 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.connectTimeout- a connect timeout in milliseconds.readTimeout- a read timeout in milliseconds.- Returns:
- an input stream of connection related to the last redirected url.
- Throws:
IOException- signals that an I/O exception has occurred.
-