本文整理汇总了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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例12: encodeRest
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
buffer.writeString(key);
buffer.writeString(data);
}
示例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);
}
示例14: encodeRest
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
buffer.writeString(name);
buffer.writeInt(lastConfirmedCommandID);
}
示例15: encodeRest
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
buffer.writeString(clusterUser);
buffer.writeString(clusterPassword);
}