Interface FileFinder
- All Known Subinterfaces:
StaticFiles
- All Known Implementing Classes:
BasicFileFinder
,BasicStaticFiles
,FileFinder.Void
,StaticFiles.Void
Example:
If the
"MyResource_ja_JP.txt" "MyResource_ja.txt" "MyResource.txt"
The default implementation of this interface is BasicFileFinder
.
The FileFinder.Builder.type(Class)
method is provided for instantiating other instances.
Example:
Subclasses must provide a public constructor that takes in any of the following arguments:
FileFinder.Builder
- The builder object.- Any beans present in the bean store passed into the constructor.
- Any
Optional
beans optionally present in bean store passed into the constructor.
See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Builder class.static class
Represents no file finder -
Method Summary
Modifier and TypeMethodDescriptionstatic FileFinder.Builder
create()
Static creator.static FileFinder.Builder
Static creator.Returns the contents of the resource with the specified name.Returns the file with the specified name as a string.
-
Method Details
-
create
Static creator.- Parameters:
beanStore
- The bean store to use for creating beans.- Returns:
- A new builder for this object.
-
create
Static creator.- Returns:
- A new builder for this object.
-
getStream
Returns the contents of the resource with the specified name.- Parameters:
name
- The resource name. SeeClass.getResource(String)
for format.locale
- The locale of the resource to retrieve.
Ifnull , won't look for localized file names.- Returns:
- The resolved resource contents, or
null if the resource was not found. - Throws:
IOException
- Thrown by underlying stream.
-
getString
Returns the file with the specified name as a string.- Parameters:
name
- The file name.locale
- The locale of the resource to retrieve.
Ifnull , won't look for localized file names.- Returns:
- The contents of the file as a string. Assumes UTF-8 encoding.
- Throws:
IOException
- If file could not be read.
-