本文整理了Java中org.fusesource.hawtbuf.Buffer.bigEndianEditor()
方法的一些代码示例,展示了Buffer.bigEndianEditor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.bigEndianEditor()
方法的具体详情如下:
包路径:org.fusesource.hawtbuf.Buffer
类名称:Buffer
方法名:bigEndianEditor
暂无
代码示例来源:origin: org.apache.qpid/proton-hawtdispatch
public Object apply() throws IOException {
Buffer sizeBytes = peekBytes(4);
if (sizeBytes != null) {
int size = sizeBytes.bigEndianEditor().readInt();
if (size < 8) {
throw new IOException(String.format("specified frame size %d is smaller than minimum frame size", size));
}
if( size > maxFrameSize ) {
throw new IOException(String.format("specified frame size %d is larger than maximum frame size", size));
}
// TODO: check frame min and max size..
nextDecodeAction = readFrame(size);
return nextDecodeAction.apply();
} else {
return null;
}
}
};
代码示例来源:origin: apache/activemq-artemis
/**
* Given a long value, convert it to a byte array for marshalling.
*
* @param value the value to convert.
* @return a new byte array that holds the big endian value of the long.
*/
public static byte[] toBytes(long value) {
Buffer buffer = new Buffer(8);
buffer.bigEndianEditor().writeLong(value);
return buffer.data;
}
代码示例来源:origin: org.apache.activemq/activemq-all
/**
* Given a long value, convert it to a byte array for marshalling.
*
* @param value
* the value to convert.
*
* @return a new byte array that holds the big endian value of the long.
*/
public static byte[] toBytes(long value) {
Buffer buffer = new Buffer(8);
buffer.bigEndianEditor().writeLong(value);
return buffer.data;
}
代码示例来源:origin: org.apache.activemq/activemq-all
@Override
public void reset(int nextExpectedReadSize) {
// Allocate a new Buffer to hold the incoming frame. We must write
// back the frame size value before continue on to read the indicated
// frame size minus the size of the AMQP frame size header value.
frame = new Buffer(nextExpectedReadSize);
frame.bigEndianEditor().writeInt(nextExpectedReadSize);
// Reset the length to total length as we do direct write after this.
frame.length = frame.data.length;
}
};
代码示例来源:origin: org.apache.activemq/activemq-osgi
@Override
public void reset(int nextExpectedReadSize) {
// Allocate a new Buffer to hold the incoming frame. We must write
// back the frame size value before continue on to read the indicated
// frame size minus the size of the AMQP frame size header value.
frame = new Buffer(nextExpectedReadSize);
frame.bigEndianEditor().writeInt(nextExpectedReadSize);
// Reset the length to total length as we do direct write after this.
frame.length = frame.data.length;
}
};
代码示例来源:origin: org.apache.activemq/activemq-osgi
/**
* Given a long value, convert it to a byte array for marshalling.
*
* @param value
* the value to convert.
*
* @return a new byte array that holds the big endian value of the long.
*/
public static byte[] toBytes(long value) {
Buffer buffer = new Buffer(8);
buffer.bigEndianEditor().writeLong(value);
return buffer.data;
}
代码示例来源:origin: apache/activemq-artemis
/**
* Converts a Binary value to a long assuming that the contained value is
* stored in Big Endian encoding.
*
* @param value the Binary object whose payload is converted to a long.
* @return a long value constructed from the bytes of the Binary instance.
*/
public static long toLong(Binary value) {
Buffer buffer = new Buffer(value.getArray(), value.getArrayOffset(), value.getLength());
return buffer.bigEndianEditor().readLong();
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
/**
* Converts a Binary value to a long assuming that the contained value is
* stored in Big Endian encoding.
*
* @param value
* the Binary object whose payload is converted to a long.
*
* @return a long value constructed from the bytes of the Binary instance.
*/
public static long toLong(Binary value) {
Buffer buffer = new Buffer(value.getArray(), value.getArrayOffset(), value.getLength());
return buffer.bigEndianEditor().readLong();
}
代码示例来源:origin: org.apache.activemq/activemq-all
/**
* Converts a Binary value to a long assuming that the contained value is
* stored in Big Endian encoding.
*
* @param value
* the Binary object whose payload is converted to a long.
*
* @return a long value constructed from the bytes of the Binary instance.
*/
public static long toLong(Binary value) {
Buffer buffer = new Buffer(value.getArray(), value.getArrayOffset(), value.getLength());
return buffer.bigEndianEditor().readLong();
}
代码示例来源:origin: org.apache.aries.rsa.provider/org.apache.aries.rsa.provider.fastbin
public void run() {
if(holder!=null)
holder.factory.unget();
final Buffer command = baos.toBuffer();
// Update the size field.
BufferEditor editor = command.buffer().bigEndianEditor();
editor.writeInt(command.length);
queue().execute(new Runnable() {
public void run() {
transport.offer(command);
}
});
}
});
代码示例来源:origin: org.apache.activemq/activemq-osgi
@Override
public Object unmarshal(DataInput dataIn) throws IOException {
if (!magicRead) {
Buffer magic = new Buffer(8);
magic.readFrom(dataIn);
magicRead = true;
return new AmqpHeader(magic, false);
} else {
int size = dataIn.readInt();
if (size > maxFrameSize) {
throw new AmqpProtocolException("Frame size exceeded max frame length.");
} else if (size <= 0) {
throw new AmqpProtocolException("Frame size value was invalid: " + size);
}
Buffer frame = new Buffer(size);
frame.bigEndianEditor().writeInt(size);
frame.readFrom(dataIn);
frame.clear();
return frame;
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
@Override
public Object unmarshal(DataInput dataIn) throws IOException {
if (!magicRead) {
Buffer magic = new Buffer(8);
magic.readFrom(dataIn);
magicRead = true;
return new AmqpHeader(magic, false);
} else {
int size = dataIn.readInt();
if (size > maxFrameSize) {
throw new AmqpProtocolException("Frame size exceeded max frame length.");
} else if (size <= 0) {
throw new AmqpProtocolException("Frame size value was invalid: " + size);
}
Buffer frame = new Buffer(size);
frame.bigEndianEditor().writeInt(size);
frame.readFrom(dataIn);
frame.clear();
return frame;
}
}
代码示例来源:origin: org.apache.aries.rsa.provider/org.apache.aries.rsa.provider.fastbin
BufferEditor editor = command.buffer().bigEndianEditor();
editor.writeInt(command.length);
handler.lastRequestSize = command.length;
代码示例来源:origin: jboss-fuse/fabric8
BufferEditor editor = command.buffer().bigEndianEditor();
editor.writeInt(command.length);
handler.lastRequestSize = command.length;
内容来源于网络,如有侵权,请联系作者删除!