Class FileYangTextSource
java.lang.Object
com.google.common.io.CharSource
org.opendaylight.yangtools.yang.model.api.source.YangTextSource
org.opendaylight.yangtools.yang.model.spi.source.FileYangTextSource
- All Implemented Interfaces:
Delegator<Path>
,Immutable
,SourceRepresentation
,YangSourceRepresentation
A
YangTextSource
backed by a file.-
Constructor Summary
ConstructorsConstructorDescriptionFileYangTextSource
(Path path) Utility constructor.FileYangTextSource
(SourceIdentifier sourceId, Path path, Charset charset) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected MoreObjects.ToStringHelper
addToStringAttributes
(MoreObjects.ToStringHelper toStringHelper) Add subclass-specific attributes to the outputYangTextSource.toString()
output.final Path
Return underlying delegate.final Reader
final SourceIdentifier
sourceId()
TheSourceIdentifier
of this source.final @NonNull String
Return the symbolic name, if available.Methods inherited from class org.opendaylight.yangtools.yang.model.api.source.YangTextSource
getType, toString
Methods inherited from class com.google.common.io.CharSource
asByteSource, concat, concat, concat, copyTo, copyTo, empty, forEachLine, isEmpty, length, lengthIfKnown, lines, openBufferedStream, read, readFirstLine, readLines, readLines, wrap
-
Constructor Details
-
FileYangTextSource
Default constructor.- Parameters:
path
- Backing pathsourceId
- source identifiercharset
- expected stream character set- Throws:
NullPointerException
- if any argument isnull
IllegalArgumentException
- if the supplied path is not a regular file
-
FileYangTextSource
Utility constructor. Derives theSourceIdentifier
fromPath
and assumes UTF-8 encoding.- Parameters:
path
- backing path- Throws:
NullPointerException
- ifpath
isnull
-
-
Method Details
-
openStream
- Specified by:
openStream
in classCharSource
- Throws:
IOException
-
symbolicName
Description copied from interface:SourceRepresentation
Return the symbolic name, if available. This name has no semantic meaning beyond being useful for debugging by humans.- Returns:
- Symbolic name, if available
-
addToStringAttributes
protected MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper toStringHelper) Description copied from class:YangTextSource
Add subclass-specific attributes to the outputYangTextSource.toString()
output. Since subclasses are prevented from overridingYangTextSource.toString()
for consistency reasons, they can add their specific attributes to the resulting string by attaching attributes to the suppliedMoreObjects.ToStringHelper
.- Overrides:
addToStringAttributes
in classYangTextSource
- Parameters:
toStringHelper
- ToStringHelper onto the attributes can be added- Returns:
- ToStringHelper supplied as input argument.
-
sourceId
Description copied from interface:SourceRepresentation
TheSourceIdentifier
of this source.- Specified by:
sourceId
in interfaceSourceRepresentation
- Returns:
SourceIdentifier
of this source
-
getDelegate
Description copied from interface:Delegator
Return underlying delegate.- Specified by:
getDelegate
in interfaceDelegator<T>
- Returns:
- underlying delegate.
-