Package eu.bandm.tools.util.files
Class SourceHabitats.SourceHabitat
java.lang.Object
eu.bandm.tools.util.files.SourceHabitats.SourceHabitat
- Direct Known Subclasses:
SourceHabitats.SourceHabitat_file
,SourceHabitats.SourceHabitat_resource
- Enclosing class:
- SourceHabitats
Represents one of many potential sources which have
to be searched for library modules, etc.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected @Opt SourceHabitats.FoundSource
test_for_inputStream
(String id, @Opt BiConsumer<String, Object[]> verbose, String[] suffices) Deliver an input source or null, if no resource found.protected abstract @Opt SourceHabitats.FoundSource
test_idExt
(String id, @Opt BiConsumer<String, Object[]> verbose, String ext) Finds the resource with the given name.
-
Field Details
-
name
Must be encoded with the prefix rules, as described in the class doc text. -
ok
protected boolean okSet once on initialization to indicate that this Habitat is usable for searching.
-
-
Constructor Details
-
SourceHabitat
-
-
Method Details
-
test_idExt
@Opt protected abstract @Opt SourceHabitats.FoundSource test_idExt(String id, @Opt @Opt BiConsumer<String, Object[]> verbose, String ext) Finds the resource with the given name. This must be implemented differently for different kinds of Habitats.- Parameters:
id
- name of the resource (mostly the file name "stem")ext
- extension of the resource name / file name. The leading dot (=".") must be included.- Returns:
- the found resource or null if no such exists.
-
test_for_inputStream
@Opt protected @Opt SourceHabitats.FoundSource test_for_inputStream(String id, @Opt @Opt BiConsumer<String, Object[]> verbose, String[] suffices) Deliver an input source or null, if no resource found. Fills in the found stream and "location" into the aSourceHabitats.FoundSource
object. This implementation works for all kinds of habitats by callingtest_idExt(java.lang.String,@eu.bandm.tools.annotations.Opt java.util.function.BiConsumer<java.lang.String,java.lang.Object[]>,java.lang.String)
.
-