本文整理了Java中org.fusesource.hawtbuf.Buffer.getLength()
方法的一些代码示例,展示了Buffer.getLength()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.getLength()
方法的具体详情如下:
包路径:org.fusesource.hawtbuf.Buffer
类名称:Buffer
方法名:getLength
暂无
代码示例来源:origin: org.apache.activemq/activemq-osgi
public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
out.writeLong(bean.f_key);
out.writeInt(bean.f_type);
if( bean.f_meta!=null ) {
out.writeInt(bean.f_meta.getLength());
out.write(bean.f_meta.getData(), bean.f_meta.getOffset(), bean.f_meta.getLength());
} else {
out.writeInt(-1);
}
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
static public String decode(Buffer value)
{
int size = value.getLength();
char rc[] = new char[size];
for( int i=0; i < size; i++ ) {
rc[i] = (char)(value.get(i) & 0xFF );
}
return new String(rc);
}
代码示例来源:origin: org.apache.activemq/activemq-leveldb-store
public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
out.writeLong(bean.f_collectionKey);
if( bean.f_entryKey!=null ) {
out.writeInt(bean.f_entryKey.getLength());
out.write(bean.f_entryKey.getData(), bean.f_entryKey.getOffset(), bean.f_entryKey.getLength());
} else {
out.writeInt(-1);
}
}
代码示例来源:origin: org.apache.activemq/activemq-leveldb
public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
out.writeLong(bean.f_key);
out.writeInt(bean.f_type);
if( bean.f_meta!=null ) {
out.writeInt(bean.f_meta.getLength());
out.write(bean.f_meta.getData(), bean.f_meta.getOffset(), bean.f_meta.getLength());
} else {
out.writeInt(-1);
}
}
代码示例来源:origin: org.apache.activemq/activemq-leveldb-store
public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
out.writeLong(bean.f_key);
out.writeInt(bean.f_type);
if( bean.f_meta!=null ) {
out.writeInt(bean.f_meta.getLength());
out.write(bean.f_meta.getData(), bean.f_meta.getOffset(), bean.f_meta.getLength());
} else {
out.writeInt(-1);
}
}
代码示例来源:origin: org.fusesource.fuse-extra/fusemq-leveldb
public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
out.writeLong(bean.f_key);
out.writeInt(bean.f_type);
if( bean.f_meta!=null ) {
out.writeInt(bean.f_meta.getLength());
out.write(bean.f_meta.getData(), bean.f_meta.getOffset(), bean.f_meta.getLength());
} else {
out.writeInt(-1);
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
static public String decode(Buffer value)
{
int size = value.getLength();
char rc[] = new char[size];
for( int i=0; i < size; i++ ) {
rc[i] = (char)(value.get(i) & 0xFF );
}
return new String(rc);
}
代码示例来源:origin: org.apache.activemq/activemq-all
public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
out.writeLong(bean.f_key);
out.writeInt(bean.f_type);
if( bean.f_meta!=null ) {
out.writeInt(bean.f_meta.getLength());
out.write(bean.f_meta.getData(), bean.f_meta.getOffset(), bean.f_meta.getLength());
} else {
out.writeInt(-1);
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
out.writeLong(bean.f_collectionKey);
if( bean.f_entryKey!=null ) {
out.writeInt(bean.f_entryKey.getLength());
out.write(bean.f_entryKey.getData(), bean.f_entryKey.getOffset(), bean.f_entryKey.getLength());
} else {
out.writeInt(-1);
}
}
代码示例来源:origin: org.fusesource.hawtbuf/hawtbuf
static public String decode(Buffer value)
{
int size = value.getLength();
char rc[] = new char[size];
for( int i=0; i < size; i++ ) {
rc[i] = (char)(value.get(i) & 0xFF );
}
return new String(rc);
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
public void writeExternal(java.io.DataOutput out) throws java.io.IOException {
out.writeLong(bean.f_collectionKey);
if( bean.f_entryKey!=null ) {
out.writeInt(bean.f_entryKey.getLength());
out.write(bean.f_entryKey.getData(), bean.f_entryKey.getOffset(), bean.f_entryKey.getLength());
} else {
out.writeInt(-1);
}
}
代码示例来源:origin: org.fusesource.stompjms/stompjms-client
public String contentAsString() {
try {
return new String(content.getData(), content.getOffset(), content.getLength(), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e); // Not expected
}
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
static public String decode(Buffer buffer)
{
try {
return new String(buffer.getData(), buffer.getOffset(), buffer.getLength(), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("A UnsupportedEncodingException was thrown for teh UTF-8 encoding. (This should never happen)");
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
static public String decode(Buffer buffer)
{
try {
return new String(buffer.getData(), buffer.getOffset(), buffer.getLength(), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("A UnsupportedEncodingException was thrown for teh UTF-8 encoding. (This should never happen)");
}
}
代码示例来源:origin: org.fusesource.hawtbuf/hawtbuf
/**
* reset the <code>StoreByteArrayInputStream</code> to use an new
* Buffer
*
* @param buffer
*/
public void restart(Buffer buffer) {
this.buf = buffer.getData();
this.offset = buffer.getOffset();
this.pos = this.offset;
this.length = buffer.getLength();
}
代码示例来源:origin: org.apache.activemq/activemq-all
/**
* reset the <code>StoreByteArrayInputStream</code> to use an new
* Buffer
*
* @param buffer
*/
public void restart(Buffer buffer) {
this.buf = buffer.getData();
this.offset = buffer.getOffset();
this.pos = this.offset;
this.length = buffer.getLength();
}
代码示例来源:origin: io.fabric8/gateway-core
protected void tightMarshalBuffer2(Buffer data, DataByteArrayOutputStream dataOut, BooleanStream bs)
throws IOException {
if (bs.readBoolean()) {
dataOut.writeInt(data.getLength());
dataOut.write(data.getData(), data.getOffset(), data.getLength());
}
}
代码示例来源:origin: io.fabric8/gateway-core
protected void looseMarshalBuffer(OpenWireFormat wireFormat, Buffer data, DataByteArrayOutputStream dataOut)
throws IOException {
dataOut.writeBoolean(data != null);
if (data != null) {
dataOut.writeInt(data.getLength());
dataOut.write(data.getData(), data.getOffset(), data.getLength());
}
}
代码示例来源:origin: org.fusesource.stompjms/stompjms-client
public String getText() throws JMSException {
Buffer buffer = getContent();
if (text == null && buffer != null) {
this.text = new String(buffer.getData(), buffer.getOffset(), buffer.getLength());
setContent(null);
}
return text;
}
代码示例来源:origin: org.fusesource.stompjms/stompjms-client
private void initializeReading() throws JMSException {
checkWriteOnlyBody();
if (dataIn == null) {
Buffer buffer = getContent();
if (buffer==null) {
buffer = new Buffer(0);
}
dataIn = new DataInputStream(new ByteArrayInputStream(buffer));
this.length = buffer.getLength();
}
}
内容来源于网络,如有侵权,请联系作者删除!