当前位置: 首页>>代码示例>>Java>>正文


Java ActiveMQBuffer.resetReaderIndex方法代码示例

本文整理汇总了Java中org.apache.activemq.artemis.api.core.ActiveMQBuffer.resetReaderIndex方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQBuffer.resetReaderIndex方法的具体用法?Java ActiveMQBuffer.resetReaderIndex怎么用?Java ActiveMQBuffer.resetReaderIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.activemq.artemis.api.core.ActiveMQBuffer的用法示例。


在下文中一共展示了ActiveMQBuffer.resetReaderIndex方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testReadUTF

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Test
public void testReadUTF() throws Exception {
   ActiveMQBuffer buffer = ActiveMQBuffers.fixedBuffer(10 * 1024);

   buffer.writeUTF(str);

   for (int c = 0; c < TIMES; c++) {
      ThreadLeakCheckRule.forceGC();
      final long start = System.currentTimeMillis();
      for (long i = 0; i < numberOfIteractions; i++) {
         buffer.resetReaderIndex();
         String newstr = buffer.readUTF();
         Assert.assertEquals(str, newstr);
         blackHole = newstr;
      }
      final long spentTime = System.currentTimeMillis() - start;

      System.out.println("Time readUTF = " + spentTime + " ms");
      System.out.println("Throughput readUTF = " + numberOfIteractions / spentTime + " ops/ms");
   }

}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:UTF8Test.java

示例2: decode

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
public StompFrame decode(ActiveMQBuffer buffer) throws ActiveMQStompException {
   StompFrame frame = null;
   try {
      frame = frameHandler.decode(buffer);
   } catch (ActiveMQStompException e) {
      switch (e.getCode()) {
         case ActiveMQStompException.INVALID_EOL_V10:
            if (version != null)
               throw e;
            frameHandler = new StompFrameHandlerV12(this, scheduledExecutorService, factory);
            buffer.resetReaderIndex();
            frame = decode(buffer);
            break;
         case ActiveMQStompException.INVALID_COMMAND:
         case ActiveMQStompException.UNDEFINED_ESCAPE:
            frameHandler.onError(e);
            break;
         default:
            throw e;
      }
   }
   return frame;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:StompConnection.java

示例3: checkData

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
private void checkData(JDBCSequentialFile file, ActiveMQBuffer expectedData) throws SQLException {
   expectedData.resetReaderIndex();

   byte[] resultingBytes = new byte[expectedData.readableBytes()];
   ByteBuffer byteBuffer = ByteBuffer.allocate(expectedData.readableBytes());

   file.read(byteBuffer, null);
   expectedData.getBytes(0, resultingBytes);

   assertArrayEquals(resultingBytes, byteBuffer.array());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:12,代码来源:JDBCSequentialFileFactoryTest.java

示例4: assertEqualsBuffers

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
public static void assertEqualsBuffers(final int size, final ActiveMQBuffer expected, final ActiveMQBuffer actual) {
   // assertEquals(expected.length, actual.length);
   expected.readerIndex(0);
   actual.readerIndex(0);

   for (int i = 0; i < size; i++) {
      byte b1 = expected.readByte();
      byte b2 = actual.readByte();
      Assert.assertEquals("byte at index " + i, b1, b2);
   }
   expected.resetReaderIndex();
   actual.resetReaderIndex();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:14,代码来源:ActiveMQTestBase.java

示例5: doBeforeReceive

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
public void doBeforeReceive() throws ActiveMQException {
   message.checkCompletion();

   ActiveMQBuffer body = message.getBodyBuffer();

   if (body != null) {
      body.resetReaderIndex();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:10,代码来源:ActiveMQMessage.java

示例6: bytesMessageReset

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
public static void bytesMessageReset(ActiveMQBuffer message) {
   message.resetReaderIndex();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:4,代码来源:BytesMessageUtil.java

示例7: readBodyMap

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
/**
 * Utility method to set the map on a message body
 */
public static void readBodyMap(ActiveMQBuffer message, TypedProperties map) {
   message.resetReaderIndex();
   map.decode(message.byteBuf());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:8,代码来源:MapMessageUtil.java

示例8: readBodyText

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
/**
 * Utility method to set the Text message on a message body
 */
public static SimpleString readBodyText(ActiveMQBuffer buff) {
   buff.resetReaderIndex();
   return buff.readNullableSimpleString();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:8,代码来源:TextMessageUtil.java


注:本文中的org.apache.activemq.artemis.api.core.ActiveMQBuffer.resetReaderIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。