org.fusesource.hawtbuf.Buffer.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.fusesource.hawtbuf.Buffer.<init>()方法的一些代码示例,展示了Buffer.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.<init>()方法的具体详情如下:
包路径:org.fusesource.hawtbuf.Buffer
类名称:Buffer
方法名:<init>

Buffer.<init>介绍

暂无

代码示例

代码示例来源:origin: fusesource/mqtt-client

static private  String hex(SocketAddress address) {
  if( address instanceof InetSocketAddress ) {
    InetSocketAddress isa = (InetSocketAddress)address;
    return HexSupport.toHexFromBuffer(new Buffer(isa.getAddress().getAddress()))+Integer.toHexString(isa.getPort());
  }
  return "";
}

代码示例来源:origin: fusesource/mqtt-client

public MQTTFrame apply() throws IOException {
    int limit = readBuffer.position();
    if ((limit - readStart) < length) {
      readEnd = limit;
      return null;
    } else {
      Buffer body = new Buffer(readBuffer.array(), readStart, length);
      readEnd = readStart = readStart + length;
      nextDecodeAction = readHeader;
      return new MQTTFrame(body).header(header);
    }
  }
};

代码示例来源:origin: fusesource/mqtt-client

public void publish(final String topic, final byte[] payload, final QoS qos, final boolean retain) throws Exception {
  publish(utf8(topic), new Buffer(payload), qos, retain);
}

代码示例来源:origin: fusesource/mqtt-client

public void publish(String topic, byte[] payload, QoS qos, boolean retain, Callback<Void> cb) {
  publish(utf8(topic), new Buffer(payload), qos, retain, cb);
}

代码示例来源:origin: fusesource/mqtt-client

public Future<Void> publish(final String topic, final byte[] payload, final QoS qos, final boolean retain) {
  return publish(utf8(topic), new Buffer(payload), qos, retain);
}

代码示例来源:origin: fusesource/mqtt-client

raf.seek(0);
  raf.readFully(data);
  main.body = new Buffer(data);
} finally {
  raf.close();

代码示例来源:origin: fusesource/mqtt-client

public PUBLISH decode(MQTTFrame frame) throws ProtocolException {
  assert(frame.buffers.length == 1);
  header(frame.header());
  DataByteArrayInputStream is = new DataByteArrayInputStream(frame.buffers[0]);
  topicName = MessageSupport.readUTF(is);
  
  QoS qos = qos();
  if(qos != QoS.AT_MOST_ONCE) {
    messageId = is.readShort();
  }
  payload = is.readBuffer(is.available());
  if( payload == null ) {
    payload = new Buffer(0);
  }
  return this;
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

@Override
  protected Buffer createBuffer(byte[] data) {
    return new Buffer(data);
  }
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

final public Buffer trimFront() {
  byte data[] = this.data;
  int offset = this.offset;
  int end = offset+this.length;
  int pos = offset;
  while ((pos < end) && (data[pos] <= ' ')) {
    pos++;
  }
  return (pos == offset) ? this : new Buffer(data, pos, (length-(pos-offset))); 
}

代码示例来源:origin: org.apache.activemq/activemq-all

public final Buffer slice(int low, int high) {
  int sz;
  if (high < 0) {
    sz = length + high;
  } else {
    sz = high - low;
  }
  if (sz < 0) {
    sz = 0;
  }
  return new Buffer(data, (offset + low), sz);
}

代码示例来源:origin: org.apache.activemq/activemq-all

final public Buffer trimFront() {
  byte data[] = this.data;
  int offset = this.offset;
  int end = offset+this.length;
  int pos = offset;
  while ((pos < end) && (data[pos] <= ' ')) {
    pos++;
  }
  return (pos == offset) ? this : new Buffer(data, pos, (length-(pos-offset))); 
}

代码示例来源:origin: org.apache.activemq/activemq-all

final public Buffer deepCopy() {
  byte t[] = new byte[length];
  System.arraycopy(data, offset, t, 0, length);
  return new Buffer(t);
}

代码示例来源:origin: org.apache.activemq/activemq-all

public Buffer decode(DataInput dataIn) throws IOException {
  byte[] data = new byte[size];
  dataIn.readFully(data);
  return new Buffer(data);
}

代码示例来源:origin: org.apache.activemq/activemq-all

final public Buffer compact() {
  if (length != data.length) {
    return new Buffer(toByteArray());
  }
  return this;
}

代码示例来源:origin: org.fusesource.hawtdb/hawtdb

public void readHeader() {
  buffer = paged.slice(SliceType.READ, page, 1);
  
  Buffer m = new Buffer(magic.length);
  buffer.get(m.data);
  
  if( !magic.equals(m) ) {
    throw new IOPagingException("Invalid extent read request.  The requested page was not an extent: "+page);
  }
  
  IntBuffer ib = buffer.asIntBuffer();
  length = ib.get();
  next = ib.get();
}

代码示例来源:origin: org.fusesource.stompjms/stompjms-client

public void storeContent() throws JMSException {
  try {
    if( text == null ) {
      setContent(new Buffer(0));
    } else {
      setContent(new Buffer(text.getBytes("UTF-8")));
    }
    getHeaderMap().put(TRANSFORMATION, getMsgType().buffer);
  } catch (UnsupportedEncodingException e) {
    throw StompJmsExceptionSupport.create(e.getMessage(), e);
  }
}

代码示例来源:origin: apache/activemq-artemis

public AmqpHeader readAmqpHeader() throws Exception {
   clientSocket.setSoTimeout((int) RECEIVE_TIMEOUT);
   InputStream is = clientSocket.getInputStream();
   byte[] header = new byte[8];
   int read = is.read(header);
   if (read == header.length) {
    return new AmqpHeader(new Buffer(header));
   } else {
    return null;
   }
 }
}

代码示例来源:origin: org.fusesource.stompjms/stompjms-client

private void setBytesHeader(AsciiBuffer key, byte[]  value) {
  if(value==null) {
    getHeaderMap().remove(key);
  } else {
    getHeaderMap().put(key, new Buffer(value).deepCopy().ascii());
  }
}

代码示例来源:origin: io.fabric8/gateway-core

protected Buffer looseUnmarshalBuffer(DataByteArrayInputStream dataIn) throws IOException {
    Buffer rc = null;
    if (dataIn.readBoolean()) {
      int size = dataIn.readInt();
      byte[] t = new byte[size];
      dataIn.readFully(t);
      rc = new Buffer(t, 0, size);
    }
    return rc;
  }
}

代码示例来源: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();
}

相关文章