Package io.cui.tools.io
Interface FileLoader
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
FileReaderWriter
- All Known Implementing Classes:
ClassPathLoader,FileSystemLoader,UrlLoader
public interface FileLoader extends Serializable
Wraps different ways file loading: FileSystem (absolute), Classpath,..The implementations must be reentrant regarding
inputStream()- Author:
- Oliver Wolff
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StructuredFilenamegetFileName()URLgetURL()InputStreaminputStream()This method should be within atry-with-resourcesstatement as it is not closed by the implementation.booleanisFilesystemLoader()booleanisReadable()
-
-
-
Method Detail
-
isReadable
boolean isReadable()
- Returns:
- boolean indicating whether the concrete file exists and is accessible
-
getFileName
StructuredFilename getFileName()
- Returns:
- the filename in an appropriate presentation.
-
inputStream
InputStream inputStream() throws IOException
This method should be within atry-with-resourcesstatement as it is not closed by the implementation.- Returns:
- an
InputStreamon the corresponding file. It implicitly checksisReadable()before accessing the file and will throw anIllegalStateExceptionin case it is not readable. - Throws:
IOException
-
isFilesystemLoader
boolean isFilesystemLoader()
- Returns:
- boolean indicating that the loader loads from the file-system and not from the classpath
-
-