org.apache.qpid.proton.codec.WritableBuffer类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(132)

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

WritableBuffer介绍

暂无

代码示例

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

  1. private void endFrame(int channel)
  2. {
  3. int frameSize = _buffer.position() - _frameStart;
  4. int limit = _buffer.position();
  5. _buffer.position(_frameStart);
  6. _buffer.putInt(frameSize);
  7. _buffer.put((byte) 2);
  8. _buffer.put(_frameType);
  9. _buffer.putShort((short) channel);
  10. _buffer.position(limit);
  11. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. @Override
  2. public void put(byte b)
  3. {
  4. (_first.hasRemaining() ? _first : _second).put(b);
  5. }

代码示例来源:origin: org.apache.qpid/proton

  1. public void position(int position)
  2. {
  3. int first_limit = _first.limit();
  4. if( position <= first_limit )
  5. {
  6. _first.position(position);
  7. _second.position(0);
  8. }
  9. else
  10. {
  11. _first.position(first_limit);
  12. _second.position(position - first_limit);
  13. }
  14. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. byte encodingCode = deduceEncodingCode(flow, count);
  2. buffer.put(EncodingCodes.DESCRIBED_TYPE_INDICATOR);
  3. buffer.put(EncodingCodes.SMALLULONG);
  4. buffer.put(DESCRIPTOR_CODE);
  5. buffer.put(encodingCode);
  6. int startIndex = buffer.position();
  7. buffer.put((byte) 0);
  8. buffer.put((byte) count);
  9. } else {
  10. buffer.putInt(0);
  11. buffer.putInt(count);
  12. int endIndex = buffer.position();
  13. int writeSize = endIndex - startIndex - fieldWidth;
  14. buffer.position(startIndex);
  15. if (fieldWidth == 1) {
  16. buffer.put((byte) writeSize);
  17. } else {
  18. buffer.putInt(writeSize);
  19. buffer.position(endIndex);

代码示例来源:origin: org.apache.qpid/proton-j

  1. @Override
  2. public void put(byte[] src, int offset, int length)
  3. {
  4. final int firstRemaining = _first.remaining();
  5. if(firstRemaining > 0)
  6. {
  7. if(firstRemaining >= length)
  8. {
  9. _first.put(src, offset, length);
  10. return;
  11. }
  12. else
  13. {
  14. _first.put(src,offset, firstRemaining);
  15. }
  16. }
  17. _second.put(src, offset+firstRemaining, length-firstRemaining);
  18. }

代码示例来源:origin: org.apache.qpid/qpid-jms-client

  1. @Override
  2. public ReadableBuffer get(WritableBuffer target) {
  3. int start = target.position();
  4. if (buffer.hasArray()) {
  5. target.put(buffer.array(), buffer.arrayOffset() + buffer.readerIndex(), buffer.readableBytes());
  6. } else {
  7. target.put(buffer.nioBuffer());
  8. }
  9. int written = target.position() - start;
  10. buffer.readerIndex(buffer.readerIndex() + written);
  11. return this;
  12. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. @Override
  2. public void writeBoolean(final boolean bool)
  3. {
  4. if (bool)
  5. {
  6. _buffer.put(EncodingCodes.BOOLEAN_TRUE);
  7. }
  8. else
  9. {
  10. _buffer.put(EncodingCodes.BOOLEAN_FALSE);
  11. }
  12. }

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

  1. public void putInt(int i)
  2. {
  3. int remaining = _first.remaining();
  4. if(remaining >= 4)
  5. {
  6. _first.putInt(i);
  7. }
  8. else if(remaining ==0 )
  9. {
  10. _second.putInt(i);
  11. }
  12. else
  13. {
  14. ByteBuffer wrap = ByteBuffer.wrap(new byte[4]);
  15. wrap.putInt(i);
  16. wrap.flip();
  17. put(wrap);
  18. }
  19. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. @Override
  2. public int position()
  3. {
  4. return _first.position()+_second.position();
  5. }

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

  1. private void writePerformative(Object frameBody)
  2. {
  3. while (_buffer.remaining() < 8) {
  4. grow();
  5. }
  6. while (true)
  7. {
  8. try
  9. {
  10. _buffer.position(_frameStart + 8);
  11. if (frameBody != null) _encoder.writeObject(frameBody);
  12. break;
  13. }
  14. catch (BufferOverflowException e)
  15. {
  16. grow();
  17. }
  18. }
  19. _payloadStart = _buffer.position();
  20. _performativeSize = _payloadStart - _frameStart;
  21. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. @Override
  2. public void putShort(short s)
  3. {
  4. int remaining = _first.remaining();
  5. if(remaining >= 2)
  6. {
  7. _first.putShort(s);
  8. }
  9. else if(remaining ==0 )
  10. {
  11. _second.putShort(s);
  12. }
  13. else
  14. {
  15. ByteBuffer wrap = ByteBuffer.wrap(new byte[2]);
  16. wrap.putShort(s);
  17. wrap.flip();
  18. put(wrap);
  19. }
  20. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. @Override
  2. public void putLong(long l)
  3. {
  4. int remaining = _first.remaining();
  5. if(remaining >= 8)
  6. {
  7. _first.putLong(l);
  8. }
  9. else if(remaining ==0 )
  10. {
  11. _second.putLong(l);
  12. }
  13. else
  14. {
  15. ByteBuffer wrap = ByteBuffer.wrap(new byte[8]);
  16. wrap.putLong(l);
  17. wrap.flip();
  18. put(wrap);
  19. }
  20. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. void writeRaw(final int i)
  2. {
  3. _buffer.putInt(i);
  4. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. @Override
  2. public boolean hasRemaining()
  3. {
  4. return _first.hasRemaining() || _second.hasRemaining();
  5. }

代码示例来源:origin: org.apache.qpid/proton-j-impl

  1. void writeRaw(final long l)
  2. {
  3. _buffer.putLong(l);
  4. }

代码示例来源:origin: org.apache.qpid/proton-j-impl

  1. public int limit()
  2. {
  3. return _first.limit() + _second.limit();
  4. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. @Override
  2. public int remaining()
  3. {
  4. return _first.remaining()+_second.remaining();
  5. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. void writeRaw(final double d)
  2. {
  3. _buffer.putDouble(d);
  4. }

代码示例来源:origin: org.apache.qpid/proton-j

  1. void writeRaw(final float f)
  2. {
  3. _buffer.putFloat(f);
  4. }

代码示例来源:origin: org.apache.qpid/proton-j-impl

  1. void writeRaw(final short s)
  2. {
  3. _buffer.putShort(s);
  4. }

相关文章