EncodedResource class final
A resource paired with the character encoding to read it in;
null means UTF-8.
It carries @PropertySource(encoding: ...) to the
PropertySourceFactory, which is where applications meet it: a custom
factory reads the file through it, so the declared encoding is used.
// A legacy file in ISO-8859-1.
final resource = EncodedResource(
FileSystemResource('config/legacy.properties'),
encoding: latin1,
);
resource.readAsStringSync();
Spring (Java):
var resource = new EncodedResource(
new FileSystemResource("config/legacy.properties"),
StandardCharsets.ISO_8859_1);
Constructors
- EncodedResource(Resource resource, {Encoding? encoding})
-
Pairs
resourcewith theencodingto read it in (UTF-8 whennull).const
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readAsString(
) → Future< String> - Reads the whole content as text, decoded with encoding.
-
readAsStringSync(
) → String - Reads the whole content as text without waiting, decoded with encoding. Throws UnsupportedError when the resource cannot be read synchronously.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override