本文整理了Java中org.vertx.java.core.buffer.Buffer.getInt()
方法的一些代码示例,展示了Buffer.getInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.getInt()
方法的具体详情如下:
包路径:org.vertx.java.core.buffer.Buffer
类名称:Buffer
方法名:getInt
[英]Returns the int at position pos in the Buffer.
[中]返回缓冲区中位置pos处的整数。
代码示例来源:origin: org.vert-x/vertx-core
protected void readBody(int pos, Buffer readBuff) {
boolean isNull = readBuff.getByte(pos) == (byte)0;
if (!isNull) {
body = readBuff.getInt(++pos);
}
}
代码示例来源:origin: io.fabric8/gateway-core
public AmqpEvent apply() throws IOException {
Buffer sizeBytes = peekBytes(4);
if (sizeBytes != null) {
int size = sizeBytes.getInt(0);
if (size < 8) {
throw new IOException(String.format("specified frame size %d is smaller than minimum frame size", size));
}
if( size > protocol.maxFrameSize ) {
throw new IOException(String.format("specified frame size %d is larger than maximum frame size", size));
}
nextDecodeAction = readFrame(size);
return nextDecodeAction.apply();
} else {
return null;
}
}
};
代码示例来源:origin: jboss-fuse/fabric8
public AmqpEvent apply() throws IOException {
Buffer sizeBytes = peekBytes(4);
if (sizeBytes != null) {
int size = sizeBytes.getInt(0);
if (size < 8) {
throw new IOException(String.format("specified frame size %d is smaller than minimum frame size", size));
}
if( size > protocol.maxFrameSize ) {
throw new IOException(String.format("specified frame size %d is larger than maximum frame size", size));
}
nextDecodeAction = readFrame(size);
return nextDecodeAction.apply();
} else {
return null;
}
}
};
代码示例来源:origin: vert-x/mod-lang-php
public int getInt(Env env, NumberValue pos) {
return buffer.getInt(pos.toInt());
}
代码示例来源: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: 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: 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 BaseMessage(Buffer readBuff) {
int pos = 1;
byte bsend = readBuff.getByte(pos);
send = bsend == 0;
pos += 1;
int addressLength = readBuff.getInt(pos);
pos += 4;
byte[] addressBytes = readBuff.getBytes(pos, pos + addressLength);
pos += addressLength;
address = new String(addressBytes, CharsetUtil.UTF_8);
int port = readBuff.getInt(pos);
pos += 4;
int hostLength = readBuff.getInt(pos);
pos += 4;
byte[] hostBytes = readBuff.getBytes(pos, pos + hostLength);
pos += hostLength;
String host = new String(hostBytes, CharsetUtil.UTF_8);
sender = new ServerID(port, host);
int replyAddressLength = readBuff.getInt(pos);
pos += 4;
if (replyAddressLength > 0) {
byte[] replyAddressBytes = readBuff.getBytes(pos, pos + replyAddressLength);
pos += replyAddressLength;
replyAddress = new String(replyAddressBytes, CharsetUtil.UTF_8);
} else {
replyAddress = null;
}
readBody(pos, readBuff);
}
代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq
public Command apply() throws IOException {
Buffer header = peekBytes(4);
if (header == null) {
return null;
} else {
final int length = header.getInt(0);
if (length > protocol.maxFrameSize) {
throw new ProtocolException("Max frame size exceeded.");
}
nextDecodeAction = new Action<Command>() {
public Command apply() throws IOException {
Buffer frame = readBytes(4 + length);
if (frame == null) {
return null;
} else {
ByteArrayInputStream dataIn = new ByteArrayInputStream(frame.getBytes());
DataInputStream dataInputStream = new DataInputStream(dataIn);
Command command = (Command) format.unmarshal(dataInputStream);
nextDecodeAction = read_action;
return command;
}
}
};
return nextDecodeAction.apply();
}
}
};
代码示例来源:origin: jboss-fuse/fabric8
public Command apply() throws IOException {
Buffer header = peekBytes(4);
if( header==null ) {
return null;
} else {
final int length = header.getInt(0);
if( length > protocol.maxFrameSize ) {
throw new ProtocolException("Max frame size exceeded.");
}
nextDecodeAction = new Action<Command>() {
public Command apply() throws IOException {
Buffer frame = readBytes(4+length) ;
if( frame==null ) {
return null;
} else {
// TODO: avoid this conversion.
org.fusesource.hawtbuf.Buffer buffer = new org.fusesource.hawtbuf.Buffer(frame.getBytes());
Command command = (Command) format.unmarshal(buffer);
nextDecodeAction = read_action;
return command;
}
}
};
return nextDecodeAction.apply();
}
}
};
代码示例来源: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: io.fabric8/gateway-core
public Command apply() throws IOException {
Buffer header = peekBytes(4);
if( header==null ) {
return null;
} else {
final int length = header.getInt(0);
if( length > protocol.maxFrameSize ) {
throw new ProtocolException("Max frame size exceeded.");
}
nextDecodeAction = new Action<Command>() {
public Command apply() throws IOException {
Buffer frame = readBytes(4+length) ;
if( frame==null ) {
return null;
} else {
// TODO: avoid this conversion.
org.fusesource.hawtbuf.Buffer buffer = new org.fusesource.hawtbuf.Buffer(frame.getBytes());
Command command = (Command) format.unmarshal(buffer);
nextDecodeAction = read_action;
return command;
}
}
};
return nextDecodeAction.apply();
}
}
};
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
public Command apply() throws IOException {
Buffer header = peekBytes(4);
if (header == null) {
return null;
} else {
final int length = header.getInt(0);
if (length > protocol.maxFrameSize) {
throw new ProtocolException("Max frame size exceeded.");
}
nextDecodeAction = new Action<Command>() {
public Command apply() throws IOException {
Buffer frame = readBytes(4 + length);
if (frame == null) {
return null;
} else {
ByteArrayInputStream dataIn = new ByteArrayInputStream(frame.getBytes());
DataInputStream dataInputStream = new DataInputStream(dataIn);
Command command = (Command) format.unmarshal(dataInputStream);
nextDecodeAction = read_action;
return command;
}
}
};
return nextDecodeAction.apply();
}
}
};
代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq
int packetLength = readBuffer.getInt(readStart);
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
int packetLength = readBuffer.getInt(readStart);
内容来源于网络,如有侵权,请联系作者删除!