本文整理了Java中org.fusesource.hawtbuf.Buffer.length()
方法的一些代码示例,展示了Buffer.length()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.length()
方法的具体详情如下:
包路径:org.fusesource.hawtbuf.Buffer
类名称:Buffer
方法名:length
暂无
代码示例来源:origin: fusesource/mqtt-client
public void onPublish(UTF8Buffer topic, final Buffer payload, final Callback<Callback<Void>> onComplete) {
getDispatchQueue().assertExecuting();
receiveBufferRemaining -= payload.length();
if( !receiveBufferFull && receiveBufferRemaining <=0 ) {
receiveBufferFull = true;
suspend();
}
deliverMessage(new Message(getDispatchQueue(), topic, payload, new Callback<Callback<Void>>() {
public void onSuccess(Callback<Void> value) {
processed();
onComplete.onSuccess(value);
}
public void onFailure(Throwable value) {
processed();
onComplete.onFailure(value);
}
private void processed() {
getDispatchQueue().assertExecuting();
receiveBufferRemaining += payload.length();
if( receiveBufferFull && receiveBufferRemaining >0 ) {
receiveBufferFull = false;
resume();
}
}
}));
}
代码示例来源:origin: org.apache.activemq/activemq-all
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < buffer.length(); ++i) {
char value = (char) buffer.get(i);
if (Character.isLetter(value)) {
builder.append(value);
} else {
builder.append(",");
builder.append((int) value);
}
}
return builder.toString();
}
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < buffer.length(); ++i) {
char value = (char) buffer.get(i);
if (Character.isLetter(value)) {
builder.append(value);
} else {
builder.append(",");
builder.append((int) value);
}
}
return builder.toString();
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
public void setBuffer(Buffer value, boolean validate) {
if (validate && !value.startsWith(PREFIX) || value.length() != 8) {
throw new IllegalArgumentException("Not an AMQP header buffer");
}
buffer = value.buffer();
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
public void setBuffer(Buffer value, boolean validate) {
if (validate && !value.startsWith(PREFIX) || value.length() != 8) {
throw new IllegalArgumentException("Not an AMQP header buffer");
}
buffer = value.buffer();
}
代码示例来源:origin: org.apache.qpid/proton-hawtdispatch
public void setBuffer(Buffer value) {
if( !value.startsWith(PREFIX) || value.length()!=8 ) {
throw new IllegalArgumentException("Not an AMQP header buffer");
}
buffer = value.buffer();
}
代码示例来源:origin: org.fusesource.stompjms/stompjms-client
public void addContentLengthHeader() {
addHeader(CONTENT_LENGTH, new AsciiBuffer(Integer.toString(content.length())));
}
代码示例来源:origin: fusesource/stompjms
public void addContentLengthHeader() {
addHeader(CONTENT_LENGTH, new AsciiBuffer(Integer.toString(content.length())));
}
代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq
@Override
public void parse(DataByteArrayInputStream data, int readSize) throws IOException {
if (currentBuffer == null) {
if (contentLength < scratch.length()) {
currentBuffer = scratch;
currentBuffer.length = contentLength;
} else {
currentBuffer = new Buffer(contentLength);
}
}
int length = Math.min(readSize, contentLength - payLoadRead);
payLoadRead += data.read(currentBuffer.data, payLoadRead, length);
if (payLoadRead == contentLength) {
processCommand();
currentParser = initializeHeaderParser();
readSize = readSize - length;
if (readSize > 0) {
currentParser.parse(data, readSize);
}
}
}
代码示例来源:origin: apache/activemq-artemis
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < buffer.length(); ++i) {
char value = (char) buffer.get(i);
if (Character.isLetter(value)) {
builder.append(value);
} else {
builder.append(",");
builder.append((int) value);
}
}
return builder.toString();
}
}
代码示例来源:origin: org.fusesource.stompjms/stompjms-client
public StompFrame createCreditFrame(StompJmsMessageConsumer consumer, StompFrame messageFrame) {
final Buffer content = messageFrame.content();
String credit = "1";
if( content!=null ) {
credit += ","+content.length();
}
StompFrame frame = new StompFrame();
frame.action(ACK);
frame.headerMap().put(SUBSCRIPTION, consumer.id);
frame.headerMap().put(CREDIT, AsciiBuffer.ascii(credit));
return frame;
}
代码示例来源:origin: fusesource/stompjms
public int size() {
int rc = action.length() + 1;
if( headerList!=null ) {
for (HeaderEntry entry : headerList) {
rc += entry.getKey().length() + entry.getValue().length() + 2;
}
} else {
for (Map.Entry<AsciiBuffer,AsciiBuffer> entry : headerMap.entrySet()) {
rc += entry.getKey().length() + entry.getValue().length() + 2;
}
}
rc += content.length() + 3;
return rc;
}
代码示例来源:origin: fusesource/stompjms
public StompFrame createCreditFrame(StompJmsMessageConsumer consumer, StompFrame messageFrame) {
final Buffer content = messageFrame.content();
String credit = "1";
if( content!=null ) {
credit += ","+content.length();
}
StompFrame frame = new StompFrame();
frame.action(ACK);
frame.headerMap().put(SUBSCRIPTION, consumer.id);
frame.headerMap().put(CREDIT, AsciiBuffer.ascii(credit));
return frame;
}
代码示例来源:origin: org.fusesource.stompjms/stompjms-client
public int size() {
int rc = action.length() + 1;
if( headerList!=null ) {
for (HeaderEntry entry : headerList) {
rc += entry.getKey().length() + entry.getValue().length() + 2;
}
} else {
for (Map.Entry<AsciiBuffer,AsciiBuffer> entry : headerMap.entrySet()) {
rc += entry.getKey().length() + entry.getValue().length() + 2;
}
}
rc += content.length() + 3;
return rc;
}
代码示例来源:origin: apache/activemq-artemis
public void setBuffer(Buffer value, boolean validate) {
if (validate && !value.startsWith(PREFIX) || value.length() != 8) {
throw new IllegalArgumentException("Not an AMQP header buffer");
}
buffer = value.buffer();
}
代码示例来源:origin: org.apache.activemq/activemq-console
private void store(String ext, Buffer value) throws IOException {
TarEntry entry = new TarEntry(seq + "." + ext);
seq += 1;
entry.setSize(value.length());
stream.putNextEntry(entry);
value.writeTo(stream);
stream.closeEntry();
}
代码示例来源:origin: org.apache.activemq/activemq-all
private void store(String ext, Buffer value) throws IOException {
TarEntry entry = new TarEntry(seq + "." + ext);
seq += 1;
entry.setSize(value.length());
stream.putNextEntry(entry);
value.writeTo(stream);
stream.closeEntry();
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
private void store(String ext, Buffer value) throws IOException {
TarEntry entry = new TarEntry(seq + "." + ext);
seq += 1;
entry.setSize(value.length());
stream.putNextEntry(entry);
value.writeTo(stream);
stream.closeEntry();
}
代码示例来源:origin: org.fusesource.stompjms/stompjms-client
public Object apply() throws IOException {
Buffer line = readUntil((byte) '\n', max_command_length, "The maximum command length was exceeded");
if (line != null) {
Buffer action = line.moveTail(-1);
if (trim) {
action = action.trim();
}
if (action.length() > 0) {
StompFrame frame = new StompFrame(action.ascii());
nextDecodeAction = read_headers(frame);
return nextDecodeAction.apply();
}
}
return null;
}
};
代码示例来源:origin: fusesource/stompjms
public Object apply() throws IOException {
Buffer line = readUntil((byte) '\n', max_command_length, "The maximum command length was exceeded");
if (line != null) {
Buffer action = line.moveTail(-1);
if (trim) {
action = action.trim();
}
if (action.length() > 0) {
StompFrame frame = new StompFrame(action.ascii());
nextDecodeAction = read_headers(frame);
return nextDecodeAction.apply();
}
}
return null;
}
};
内容来源于网络,如有侵权,请联系作者删除!