本文整理了Java中org.vertx.java.core.buffer.Buffer.getBytes()
方法的一些代码示例,展示了Buffer.getBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.getBytes()
方法的具体详情如下:
包路径:org.vertx.java.core.buffer.Buffer
类名称:Buffer
方法名:getBytes
[英]Returns a copy of the entire Buffer as a byte[]
[中]以字节[]形式返回整个缓冲区的副本
代码示例来源:origin: org.vert-x/vertx-core
public Void action() throws Exception {
Files.write(target, data.getBytes());
return null;
}
};
代码示例来源:origin: org.vert-x/vertx-core
/**
* Returns a copy of a sub-sequence the Buffer as a {@code String} starting at position {@code start}
* and ending at position {@code end - 1} interpreted as a String in UTF-8 encoding
*/
public String getString(int start, int end) {
byte[] bytes = getBytes(start, end);
Charset cs = Charset.forName("UTF-8");
return new String(bytes, cs);
}
代码示例来源:origin: org.vert-x/vertx-core
/**
* Returns a copy of a sub-sequence the Buffer as a {@code String} starting at position {@code start}
* and ending at position {@code end - 1} interpreted as a String in the specified encoding
*/
public String getString(int start, int end, String enc) {
byte[] bytes = getBytes(start, end);
Charset cs = Charset.forName(enc);
return new String(bytes, cs);
}
代码示例来源:origin: org.vert-x/vertx-core
/**
* Returns a copy of a sub-sequence the Buffer as a {@link Buffer} starting at position {@code start}
* and ending at position {@code end - 1}
*/
public Buffer getBuffer(int start, int end) {
return new Buffer(getBytes(start, end));
}
代码示例来源:origin: com.englishtown/vertx-mod-jersey
@Override
public void handle(Void event) {
InputStream inputStream = new ByteArrayInputStream(body.getBytes());
DefaultJerseyHandler.this.handle(vertxRequest, inputStream);
}
});
代码示例来源:origin: org.vert-x/vertx-core
protected void readBody(int pos, Buffer readBuff) {
boolean isNull = readBuff.getByte(pos) == (byte)0;
if (!isNull) {
pos++;
int strLength = readBuff.getInt(pos);
pos += 4;
byte[] bytes = readBuff.getBytes(pos, pos + strLength);
body = new String(bytes, CharsetUtil.UTF_8);
}
}
代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq
public StompFrame apply() throws IOException {
Buffer content = readUntil((byte) 0);
if (content != null) {
nextDecodeAction = read_action;
frame.setContent(BufferSupport.chomp(content).getBytes());
return frame;
} else {
return null;
}
}
};
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
public StompFrame apply() throws IOException {
Buffer content = readUntil((byte) 0);
if (content != null) {
nextDecodeAction = read_action;
frame.setContent(BufferSupport.chomp(content).getBytes());
return frame;
} else {
return null;
}
}
};
代码示例来源:origin: org.vert-x/vertx-core
protected void readBody(int pos, Buffer readBuff) {
boolean isNull = readBuff.getByte(pos) == (byte)0;
if (!isNull) {
pos++;
int buffLength = readBuff.getInt(pos);
pos += 4;
body = readBuff.getBytes(pos, pos + buffLength);
}
}
代码示例来源:origin: org.vert-x/vertx-core
protected void readBody(int pos, Buffer readBuff) {
boolean isNull = readBuff.getByte(pos) == (byte)0;
if (!isNull) {
pos++;
int strLength = readBuff.getInt(pos);
pos += 4;
byte[] bytes = readBuff.getBytes(pos, pos + strLength);
String str = new String(bytes, CharsetUtil.UTF_8);
body = new JsonArray(str);
}
}
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
public StompFrame apply() throws IOException {
Buffer content = readBytes(contentLength + 1);
if (content != null) {
if (content.getByte(contentLength) != 0) {
throw new IOException("Expected null terminator after " + contentLength + " content bytes");
}
frame.setContent(BufferSupport.chomp(content).getBytes());
nextDecodeAction = read_action;
return frame;
} else {
return null;
}
}
};
代码示例来源:origin: org.vert-x/vertx-core
protected void readBody(int pos, Buffer readBuff) {
boolean isNull = readBuff.getByte(pos) == (byte)0;
if (!isNull) {
pos++;
int strLength = readBuff.getInt(pos);
pos += 4;
byte[] bytes = readBuff.getBytes(pos, pos + strLength);
String str = new String(bytes, CharsetUtil.UTF_8);
body = new JsonObject(str);
}
}
代码示例来源:origin: org.vert-x/vertx-core
protected void readBody(int pos, Buffer readBuff) {
boolean isNull = readBuff.getByte(pos) == (byte)0;
if (!isNull) {
pos++;
int buffLength = readBuff.getInt(pos);
pos += 4;
byte[] bytes = readBuff.getBytes(pos, pos + buffLength);
body = new Buffer(bytes);
}
}
代码示例来源:origin: jboss-fuse/fabric8
public MQTTFrame apply() throws IOException {
Buffer body = readBytes(remaining);
if( body==null ) {
return null;
} else {
nextDecodeAction = readHeader;
// TODO: optimize out this conversion to byte[]
return new MQTTFrame(new org.fusesource.hawtbuf.Buffer(body.getBytes())).header(header);
}
}
};
代码示例来源:origin: io.fabric8/gateway-core
public MQTTFrame apply() throws IOException {
Buffer body = readBytes(remaining);
if( body==null ) {
return null;
} else {
nextDecodeAction = readHeader;
// TODO: optimize out this conversion to byte[]
return new MQTTFrame(new org.fusesource.hawtbuf.Buffer(body.getBytes())).header(header);
}
}
};
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
public MQTTFrame apply() throws IOException {
Buffer body = readBytes(remaining);
if (body == null) {
return null;
} else {
nextDecodeAction = readHeader;
// TODO: optimize out this conversion to byte[]
return new MQTTFrame(new org.fusesource.hawtbuf.Buffer(body.getBytes())).header(header);
}
}
};
代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq
public MQTTFrame apply() throws IOException {
Buffer body = readBytes(remaining);
if (body == null) {
return null;
} else {
nextDecodeAction = readHeader;
// TODO: optimize out this conversion to byte[]
return new MQTTFrame(new org.fusesource.hawtbuf.Buffer(body.getBytes())).header(header);
}
}
};
代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq
private void process(Buffer event) {
if (!isStopped() && !isStopping()) {
try {
int length = event.length();
org.fusesource.hawtbuf.DataByteArrayInputStream dataIn = new org.fusesource.hawtbuf.DataByteArrayInputStream(event.getBytes());
codec.parse(dataIn, length);
} catch (Throwable e) {
transport.handleException(e);
}
}
}
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
private void process(Buffer event) {
if (!isStopped() && !isStopping()) {
try {
int length = event.length();
org.fusesource.hawtbuf.DataByteArrayInputStream dataIn = new org.fusesource.hawtbuf.DataByteArrayInputStream(event.getBytes());
codec.parse(dataIn, length);
} catch (Throwable e) {
transport.handleException(e);
}
}
}
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
private void process(Buffer event) {
if (!isStopped() && !isStopping()) {
try {
int length = event.length();
org.fusesource.hawtbuf.DataByteArrayInputStream dataIn = new org.fusesource.hawtbuf.DataByteArrayInputStream(event.getBytes());
codec.parse(dataIn, length);
} catch (Throwable e) {
transport.handleException(e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!