本文整理汇总了Java中hudson.console.LineTransformationOutputStream类的典型用法代码示例。如果您正苦于以下问题:Java LineTransformationOutputStream类的具体用法?Java LineTransformationOutputStream怎么用?Java LineTransformationOutputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineTransformationOutputStream类属于hudson.console包,在下文中一共展示了LineTransformationOutputStream类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decorateLogger
import hudson.console.LineTransformationOutputStream; //导入依赖的package包/类
@Override public OutputStream decorateLogger(AbstractBuild _ignore, final OutputStream logger) throws IOException, InterruptedException {
final Pattern p = Pattern.compile(pattern.getPlainText());
return new LineTransformationOutputStream() {
@Override protected void eol(byte[] b, int len) throws IOException {
if (!p.toString().isEmpty()) {
Matcher m = p.matcher(new String(b, 0, len, charsetName));
if (m.find()) {
logger.write(m.replaceAll("****").getBytes(charsetName));
} else {
// Avoid byte → char → byte conversion unless we are actually doing something.
logger.write(b, 0, len);
}
} else {
// Avoid byte → char → byte conversion unless we are actually doing something.
logger.write(b, 0, len);
}
}
};
}
示例2: decorateLogger
import hudson.console.LineTransformationOutputStream; //导入依赖的package包/类
@SuppressWarnings("rawtypes") // inherited
@Override public OutputStream decorateLogger(AbstractBuild _ignore, final OutputStream logger) throws IOException, InterruptedException {
return new LineTransformationOutputStream() {
@Override protected void eol(byte[] b, int len) throws IOException {
logger.write(new String(b, 0, len).toUpperCase(Locale.ROOT).getBytes());
}
};
}
示例3: decorateLogger
import hudson.console.LineTransformationOutputStream; //导入依赖的package包/类
@Override public OutputStream decorateLogger(final AbstractBuild build, final OutputStream logger) throws IOException, InterruptedException {
return new LineTransformationOutputStream() {
Pattern p;
@Override protected void eol(byte[] b, int len) throws IOException {
if (p == null) {
p = getPatternForBuild(build);
}
if (p != null && !p.toString().isEmpty()) {
Matcher m = p.matcher(new String(b, 0, len, charsetName));
if (m.find()) {
logger.write(m.replaceAll("****").getBytes(charsetName));
} else {
// Avoid byte → char → byte conversion unless we are actually doing something.
logger.write(b, 0, len);
}
} else {
// Avoid byte → char → byte conversion unless we are actually doing something.
logger.write(b, 0, len);
}
}
@Override public void close() throws IOException {
super.close();
logger.close();
}
};
}