本文整理了Java中org.vertx.java.core.buffer.Buffer.toString()
方法的一些代码示例,展示了Buffer.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.toString()
方法的具体详情如下:
包路径:org.vertx.java.core.buffer.Buffer
类名称:Buffer
方法名:toString
[英]Returns a String represention of the Buffer assuming it contains a String encoding in UTF-8
[中]假设缓冲区包含UTF-8格式的字符串编码,则返回缓冲区的字符串表示形式
代码示例来源:origin: io.fabric8/gateway-core
@Override
public String toString() {
return buffer.toString();
}
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public String toString() {
return buffer.toString();
}
}
代码示例来源:origin: vert-x/mod-lang-php
public String toString() {
return buffer.toString();
}
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
@Override
public boolean matches(Buffer buffer) {
String header = buffer.toString();
return header.startsWith(Stomp.Commands.CONNECT) ||
header.startsWith(Stomp.Commands.STOMP);
}
代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq
@Override
public boolean matches(Buffer buffer) {
String header = buffer.toString();
return header.startsWith(Stomp.Commands.CONNECT) ||
header.startsWith(Stomp.Commands.STOMP);
}
代码示例来源:origin: RichardHightower/slumberdb
@Override
public void handle(Buffer buffer) {
if (verbose) {
puts("Recieved data", buffer.toString());
}
handleMessageFromServer(buffer.toString());
}
});
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
@Override
public boolean matches(Buffer buffer) {
String header = buffer.toString();
return
header.startsWith("GET") ||
header.startsWith("HEAD") ||
header.startsWith("POST") ||
header.startsWith("PUT") ||
header.startsWith("DELETE") ||
header.startsWith("OPTIONS") ||
header.startsWith("TRACE") ||
header.startsWith("CONNECT");
}
代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq
@Override
public boolean matches(Buffer buffer) {
String header = buffer.toString();
return
header.startsWith("GET") ||
header.startsWith("HEAD") ||
header.startsWith("POST") ||
header.startsWith("PUT") ||
header.startsWith("DELETE") ||
header.startsWith("OPTIONS") ||
header.startsWith("TRACE") ||
header.startsWith("CONNECT");
}
代码示例来源:origin: com.github.flowersinthesand/portal-vertx
@Override
public void handle(Buffer data) {
fire(data.toString());
}
});
代码示例来源:origin: org.vert-x/vertx-core
public synchronized void write(Buffer buffer) {
String msgStr = buffer.toString();
pendingWrites.add(msgStr);
this.messagesSize += msgStr.length();
if (listener != null) {
writePendingMessages();
}
}
代码示例来源:origin: io.vertx/mod-rxvertx
public JsonObject call(Buffer in) {
try {
return new JsonObject(in.toString(charset));
}
catch(Exception e) {
throw new RuntimeException("Unable to decode json request (e="+e+")");
}
}
};
代码示例来源:origin: RichardHightower/slumberdb
private void handleWebSocketCall(ServerWebSocket webSocket, Buffer buffer) {
String payload = buffer.toString();
if (PingRequest.isPing(payload)) {
handlePingFromClient(payload, webSocket);
return;
}
dataStoreServer.handleCallFromClient(buffer.toString(), webSocket);
}
代码示例来源:origin: org.vert-x/vertx-core
public void handle(Buffer data) {
if (!session.isClosed()) {
String msgs = data.toString();
if (msgs.equals("")) {
//Ignore empty frames
} else if ((msgs.startsWith("[\"") && msgs.endsWith("\"]")) ||
(msgs.startsWith("\"") && msgs.endsWith("\""))) {
session.handleMessages(msgs);
} else {
//Invalid JSON - we close the connection
close();
}
}
}
});
代码示例来源:origin: vert-x/mod-lang-php
public Value toString(Env env, Value enc) {
if (PhpTypes.isNull(env, enc)) {
return toString(env);
}
return env.wrapJava(buffer.toString(enc.toString()));
}
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
public StompFrame apply() throws IOException {
Buffer line = readUntil((byte) '\n', StompProtocol.maxCommandLength, "The maximum command length was exceeded");
if (line != null) {
Buffer action = BufferSupport.chomp(line);
if (trim) {
action = BufferSupport.trim(action);
}
if (action.length() > 0) {
StompFrame frame = new StompFrame(action.toString());
nextDecodeAction = read_headers(frame);
return nextDecodeAction.apply();
}
}
return null;
}
};
代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq
public StompFrame apply() throws IOException {
Buffer line = readUntil((byte) '\n', StompProtocol.maxCommandLength, "The maximum command length was exceeded");
if (line != null) {
Buffer action = BufferSupport.chomp(line);
if (trim) {
action = BufferSupport.trim(action);
}
if (action.length() > 0) {
StompFrame frame = new StompFrame(action.toString());
nextDecodeAction = read_headers(frame);
return nextDecodeAction.apply();
}
}
return null;
}
};
代码示例来源:origin: org.vert-x/vertx-core
public void handle(Buffer buff) {
String msgs = buff.toString();
if (msgs.equals("")) {
req.response.statusCode = 500;
req.response.end("Payload expected.");
return;
}
if (!session.handleMessages(msgs)) {
sendInvalidJSON(req.response);
} else {
req.response.headers().put("Content-Type", "text/plain; charset=UTF-8");
setJSESSIONID(config, req);
setCORS(req);
req.response.statusCode = 204;
req.response.end();
}
if (log.isTraceEnabled()) log.trace("XHR send processed ok");
}
});
代码示例来源:origin: org.vert-x/vertx-core
private void handleSocketData(SockJSSocket sock, Buffer data, Map<String, Handler<Message<JsonObject>>> handlers) {
JsonObject msg = new JsonObject(data.toString());
String type = getMandatoryString(msg, "type");
String address = getMandatoryString(msg, "address");
switch (type) {
case "send":
internalHandleSendOrPub(sock, true, msg, address);
break;
case "publish":
internalHandleSendOrPub(sock, false, msg, address);
break;
case "register":
internalHandleRegister(sock, address, handlers);
break;
case "unregister":
internalHandleUnregister(sock, address, handlers);
break;
default:
throw new IllegalStateException("Invalid type: " + type);
}
}
代码示例来源:origin: vert-x/mod-lang-php
@Override
public void handle(Buffer buffer) {
writeStream.write(env, env.wrapJava(buffer.toString()), null);
pumped += buffer.length();
if (writeStream.writeQueueFull(env).toBoolean()) {
readStream.pause(env);
writeStream.drainHandler(env, drainHandlerValue);
}
}
};
代码示例来源:origin: io.fabric8/gateway-core
public static String decodeHeader(Buffer value) {
if (value == null)
return null;
Buffer rc = new Buffer(value.length());
int pos = 0;
int max = value.length();
while (pos < max) {
if (startsWith(value, pos, ESCAPE_ESCAPE_SEQ.toBuffer())) {
rc.appendByte(ESCAPE_BYTE);
pos += 2;
} else if (startsWith(value, pos, COLON_ESCAPE_SEQ.toBuffer())) {
rc.appendByte(COLON_BYTE);
pos += 2;
} else if (startsWith(value, pos, NEWLINE_ESCAPE_SEQ.toBuffer())) {
rc.appendByte(NEWLINE_BYTE);
pos += 2;
} else {
rc.appendByte(value.getByte(pos));
pos += 1;
}
}
return rc.toString();
}
内容来源于网络,如有侵权,请联系作者删除!