Package com.mindee.input
Class URLInputSource
- java.lang.Object
- 
- com.mindee.input.URLInputSource
 
- 
 public class URLInputSource extends Object Input source wrapper to load remote files locally.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classURLInputSource.BuilderBuilder class for an URLInputSource.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static URLInputSource.Builderbuilder(String url)voidcleanup()protected HttpURLConnectioncreateConnection(String urlString)voidfetchFile()Fetches the file from a remote source.StringgetLocalFilename()StringgetUrl()voidsaveToFile(String filepath)Fetches the file from the URL and saves it to the specified filepath.LocalInputSourcetoLocalInputSource()Create a LocalInputSource instance from this object.
 
- 
- 
- 
Method Detail- 
builderpublic static URLInputSource.Builder builder(String url) - Parameters:
- url- URL to fetch the file from.
- Returns:
- An instance of URLInputSource.
 
 - 
fetchFilepublic void fetchFile() throws IOExceptionFetches the file from a remote source.- Throws:
- IOException- Throws if the file can't be fetched.
 
 - 
createConnectionprotected HttpURLConnection createConnection(String urlString) throws IOException - Throws:
- IOException
 
 - 
toLocalInputSourcepublic LocalInputSource toLocalInputSource() throws IOException Create a LocalInputSource instance from this object.- Returns:
- An instance of a LocalInputSource.
- Throws:
- IOException- Throws if the file can't be accessed.
 
 - 
saveToFilepublic void saveToFile(String filepath) throws IOException Fetches the file from the URL and saves it to the specified filepath.- Parameters:
- filepath- The local path where the file should be saved.
- Throws:
- IOException- If there's an error fetching or saving the file.
 
 - 
cleanuppublic void cleanup() 
 - 
getUrlpublic String getUrl() 
 - 
getLocalFilenamepublic String getLocalFilename() 
 
- 
 
-