本文整理汇总了Java中com.github.dockerjava.api.model.Frame.getPayload方法的典型用法代码示例。如果您正苦于以下问题:Java Frame.getPayload方法的具体用法?Java Frame.getPayload怎么用?Java Frame.getPayload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.dockerjava.api.model.Frame
的用法示例。
在下文中一共展示了Frame.getPayload方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNext
import com.github.dockerjava.api.model.Frame; //导入方法依赖的package包/类
@Override
public void onNext ( Frame frame ) {
// logger.info( "Got frame: {}", frame );
if ( collectFrames )
collectedFrames.add( frame );
if ( collectLog ) {
String lastLog = new String( frame.getPayload() );
// logger.info( "lastLog: {}", lastLog );
log.append( lastLog );
}
if ( writer != null ) {
try {
writer.write( new String( frame.getPayload() ) );
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//
}
示例2: onNext
import com.github.dockerjava.api.model.Frame; //导入方法依赖的package包/类
@Override
public void onNext(Frame frame) {
List<DecoderResult> result = Lists.newArrayList();
try {
StringBuilder currentLine = getBuffer(frame.getStreamType());
String newData = new String(frame.getPayload(), "UTF-8");
for (int i = 0; i < newData.length(); i++) {
char c = newData.charAt(i);
if (c == '\n') {
result.add(new DecoderResult(frame.getStreamType(), currentLine.toString()));
currentLine.setLength(0);
} else {
currentLine.append(c);
}
}
for (DecoderResult line : result) {
logger.log(line);
}
} catch (IOException e) {
onError(e);
}
}
示例3: onNext
import com.github.dockerjava.api.model.Frame; //导入方法依赖的package包/类
@Override
public final void onNext(final Frame object) {
final StreamType streamType = object.getStreamType();
final String payload = new String(object.getPayload());
if(StreamType.STDOUT.equals(streamType)) {
System.out.print(payload);
stdOutBuff.append(payload);
} else if(StreamType.STDERR.equals(streamType)) {
System.err.print(payload);
stdErrBuff.append(payload);
} else {
System.err.println("Unexpected stream type: " + object.getStreamType());
}
}
示例4: onNext
import com.github.dockerjava.api.model.Frame; //导入方法依赖的package包/类
@Override
public void onNext(Frame item) {
String msg = new String(item.getPayload());
lastSeenRec = msg;
long parsedMillis = getLogRecordMillis(msg);
if (parsedMillis > 0 && parsedMillis >= sinceMillis) {
if (pattern.matcher(msg).matches()) {
matchedRecord = msg;
super.onComplete();
}
}
}
示例5: forFrame
import com.github.dockerjava.api.model.Frame; //导入方法依赖的package包/类
public static OutputFrame forFrame(Frame frame) {
OutputType outputType = OutputType.forStreamType(frame.getStreamType());
if (outputType == null) {
return null;
}
return new OutputFrame(outputType, frame.getPayload());
}
示例6: onNext
import com.github.dockerjava.api.model.Frame; //导入方法依赖的package包/类
@Override
public void onNext(Frame item) {
String line = new String(item.getPayload());
if (matcher.match(line)) {
this.occurrences--;
if (this.occurrences == 0) {
this.containerUp.countDown();
}
}
}
示例7: getEntryMessage
import com.github.dockerjava.api.model.Frame; //导入方法依赖的package包/类
/**
* Gets the message contents from the {@link Frame}.
*
* @param message the message to get the contents for.
* @return the message contents.
*/
private String getEntryMessage(Frame frame) {
String string = new String(frame.getPayload());
return string.replace("\n", "").replace("\r", "");
}