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


Java ActiveMQBuffer.writeString方法代码示例

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


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

示例1: testReadData

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Test
public void testReadData() throws Exception {
   ActiveMQBuffer dynamic = ActiveMQBuffers.dynamicBuffer(1);

   String str1 = RandomUtil.randomString();
   String str2 = RandomUtil.randomString();
   double d1 = RandomUtil.randomDouble();
   float f1 = RandomUtil.randomFloat();

   dynamic.writeUTF(str1);
   dynamic.writeString(str2);
   dynamic.writeDouble(d1);
   dynamic.writeFloat(f1);

   LargeMessageControllerImpl readBuffer = splitBuffer(3, dynamic.toByteBuffer().array());

   Assert.assertEquals(str1, readBuffer.readUTF());
   Assert.assertEquals(str2, readBuffer.readString());
   Assert.assertEquals(d1, readBuffer.readDouble(), 0.000001);
   Assert.assertEquals(f1, readBuffer.readFloat(), 0.000001);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:LargeMessageBufferTest.java

示例2: encodeRest

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
   buffer.writeBoolean(exit);
   buffer.writeString(nodeID);
   if (!exit) {
      if (pair.getA() != null) {
         buffer.writeBoolean(true);
         pair.getA().encode(buffer);
      } else {
         buffer.writeBoolean(false);
      }
      if (pair.getB() != null) {
         buffer.writeBoolean(true);
         pair.getB().encode(buffer);
      } else {
         buffer.writeBoolean(false);
      }
      buffer.writeBoolean(last);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:ClusterTopologyChangeMessage.java

示例3: encodeRest

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
   buffer.writeBoolean(exit);
   buffer.writeString(nodeID);
   buffer.writeLong(uniqueEventID);
   if (!exit) {
      if (pair.getA() != null) {
         buffer.writeBoolean(true);
         pair.getA().encode(buffer);
      } else {
         buffer.writeBoolean(false);
      }
      if (pair.getB() != null) {
         buffer.writeBoolean(true);
         pair.getB().encode(buffer);
      } else {
         buffer.writeBoolean(false);
      }
      buffer.writeBoolean(last);
   }
   buffer.writeNullableString(backupGroupName);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:ClusterTopologyChangeMessage_V2.java

示例4: encodeRest

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
   buffer.writeString(nodeID);
   buffer.writeNullableString(backupGroupName);
   buffer.writeBoolean(backup);
   buffer.writeLong(currentEventID);
   if (connector != null) {
      buffer.writeBoolean(true);
      connector.encode(buffer);
   } else {
      buffer.writeBoolean(false);
   }
   if (backupConnector != null) {
      buffer.writeBoolean(true);
      backupConnector.encode(buffer);
   } else {
      buffer.writeBoolean(false);
   }
   buffer.writeNullableString(scaleDownGroupName);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:NodeAnnounceMessage.java

示例5: broadcastConnectors

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public synchronized void broadcastConnectors() throws Exception {
   ActiveMQBuffer buff = ActiveMQBuffers.dynamicBuffer(4096);

   buff.writeString(nodeManager.getNodeId().toString());

   buff.writeString(uniqueID);

   buff.writeInt(connectors.size());

   for (TransportConfiguration tcConfig : connectors) {
      tcConfig.encode(buff);
   }

   // Only send as many bytes as we need.
   byte[] data = new byte[buff.readableBytes()];
   buff.getBytes(buff.readerIndex(), data);

   endpoint.broadcast(data);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:BroadcastGroupImpl.java

示例6: transform

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public Message transform(final Message messageParameter) {
   ICoreMessage message = messageParameter.toCore();
   SimpleString oldProp = (SimpleString) message.getObjectProperty(new SimpleString("wibble"));

   if (!oldProp.equals(new SimpleString("bing"))) {
      throw new IllegalStateException("Wrong property value!!");
   }

   // Change a property
   message.putStringProperty(new SimpleString("wibble"), new SimpleString("bong"));

   // Change the body
   ActiveMQBuffer buffer = message.getBodyBuffer();

   buffer.readerIndex(0);

   String str = buffer.readString();

   if (!str.equals("doo be doo be doo be doo")) {
      throw new IllegalStateException("Wrong body!!");
   }

   buffer.clear();

   buffer.writeString("dee be dee be dee be dee");

   return message;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:30,代码来源:SimpleTransformer.java

示例7: testReadDataOverCached

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Test
public void testReadDataOverCached() throws Exception {
   clearDataRecreateServerDirs();

   ActiveMQBuffer dynamic = ActiveMQBuffers.dynamicBuffer(1);

   String str1 = RandomUtil.randomString();
   String str2 = RandomUtil.randomString();
   double d1 = RandomUtil.randomDouble();
   float f1 = RandomUtil.randomFloat();

   dynamic.writeUTF(str1);
   dynamic.writeString(str2);
   dynamic.writeDouble(d1);
   dynamic.writeFloat(f1);

   LargeMessageControllerImpl readBuffer = splitBuffer(3, dynamic.toByteBuffer().array(), getTestFile());

   Assert.assertEquals(str1, readBuffer.readUTF());
   Assert.assertEquals(str2, readBuffer.readString());
   Assert.assertEquals(d1, readBuffer.readDouble(), 0.00000001);
   Assert.assertEquals(f1, readBuffer.readFloat(), 0.000001);

   readBuffer.readerIndex(0);

   Assert.assertEquals(str1, readBuffer.readUTF());
   Assert.assertEquals(str2, readBuffer.readString());
   Assert.assertEquals(d1, readBuffer.readDouble(), 0.00000001);
   Assert.assertEquals(f1, readBuffer.readFloat(), 0.000001);

   readBuffer.close();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:33,代码来源:LargeMessageBufferTest.java

示例8: encodeRest

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
   buffer.writeString(name);
   buffer.writeLong(sessionChannelID);
   buffer.writeInt(version);
   buffer.writeNullableString(username);
   buffer.writeNullableString(password);
   buffer.writeInt(minLargeMessageSize);
   buffer.writeBoolean(xa);
   buffer.writeBoolean(autoCommitSends);
   buffer.writeBoolean(autoCommitAcks);
   buffer.writeInt(windowSize);
   buffer.writeBoolean(preAcknowledge);
   buffer.writeNullableString(defaultAddress);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:16,代码来源:CreateSessionMessage.java

示例9: encodeRest

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
   buffer.writeBoolean(synchronizationIsFinished);
   buffer.writeBoolean(allowsAutoFailBack);
   buffer.writeString(nodeID);
   if (synchronizationIsFinished)
      return;
   buffer.writeByte(dataType.code);
   buffer.writeInt(ids.length);
   for (long id : ids) {
      buffer.writeLong(id);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:14,代码来源:ReplicationStartSyncMessage.java

示例10: encodeRest

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
   buffer.writeString(clusterUser);
   buffer.writeString(clusterPassword);
   buffer.writeBoolean(backupWantsFailBack);
   connector.encode(buffer);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:8,代码来源:BackupRegistrationMessage.java

示例11: sendBadData

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
private static void sendBadData(BroadcastEndpointFactory factoryEndpoint) throws Exception {
   BroadcastEndpoint endpoint = factoryEndpoint.createBroadcastEndpoint();

   ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(500);

   buffer.writeString("This is a test1!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
   buffer.writeString("This is a test2!!!!!!!!!!!!!!!!!!!!!!!!!!!!");

   byte[] bytes = new byte[buffer.writerIndex()];

   buffer.readBytes(bytes);

   // messing up with the string!!!
   for (int i = bytes.length - 10; i < bytes.length; i++) {
      bytes[i] = 0;
   }

   endpoint.openBroadcaster();

   endpoint.broadcast(bytes);

   endpoint.close(true);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:DiscoveryStayAliveTest.java

示例12: encodeRest

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
   buffer.writeString(key);
   buffer.writeString(data);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:6,代码来源:SessionAddMetaDataMessage.java

示例13: encodeRest

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
   buffer.writeString(key);
   buffer.writeString(data);
   buffer.writeBoolean(requiresConfirmation);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:7,代码来源:SessionAddMetaDataMessageV2.java

示例14: encodeRest

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
   buffer.writeString(name);
   buffer.writeInt(lastConfirmedCommandID);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:6,代码来源:ReattachSessionMessage.java

示例15: encodeRest

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
   buffer.writeString(clusterUser);
   buffer.writeString(clusterPassword);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:6,代码来源:ClusterConnectMessage.java


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