use of org.cactoos.text.FormattedText in project cactoos by yegor256.
the class LoggingInputStream method available.
@Override
public int available() throws IOException {
final int avail = this.origin.available();
this.logger.log(this.level.value(), new UncheckedText(new FormattedText("There is(are) %d byte(s) available from %s.", avail, this.source)).asString());
return avail;
}
use of org.cactoos.text.FormattedText in project cactoos by yegor256.
the class LoggingInputStream method close.
@Override
public void close() throws IOException {
this.origin.close();
this.logger.log(this.level.value(), new UncheckedText(new FormattedText("Closed input stream from %s.", this.source)).asString());
}
use of org.cactoos.text.FormattedText in project cactoos by yegor256.
the class LoggingInputStream method markSupported.
@Override
public boolean markSupported() {
final boolean supported = this.origin.markSupported();
final String msg;
if (supported) {
msg = "Mark and reset are supported from %s";
} else {
msg = "Mark and reset NOT supported from %s";
}
this.logger.log(this.level.value(), new UncheckedText(new FormattedText(msg, this.source)).asString());
return supported;
}
use of org.cactoos.text.FormattedText in project cactoos by yegor256.
the class LoggingInputStream method mark.
@Override
public void mark(final int limit) {
this.origin.mark(limit);
this.logger.log(this.level.value(), new UncheckedText(new FormattedText("Marked position %d from %s.", limit, this.source)).asString());
}
use of org.cactoos.text.FormattedText in project cactoos by yegor256.
the class LoggingInputStream method skip.
@Override
public long skip(final long num) throws IOException {
final long skipped = this.origin.skip(num);
this.logger.log(this.level.value(), new UncheckedText(new FormattedText("Skipped %d byte(s) from %s.", skipped, this.source)).asString());
return skipped;
}
Aggregations