本文整理汇总了Java中org.apache.activemq.artemis.api.core.ActiveMQBuffer.writeByte方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQBuffer.writeByte方法的具体用法?Java ActiveMQBuffer.writeByte怎么用?Java ActiveMQBuffer.writeByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.artemis.api.core.ActiveMQBuffer
的用法示例。
在下文中一共展示了ActiveMQBuffer.writeByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encode
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encode(final ActiveMQBuffer buffer) {
if (txRecordType == TX_RECORD_TYPE.COMMIT) {
buffer.writeByte(JournalImpl.COMMIT_RECORD);
} else {
buffer.writeByte(JournalImpl.PREPARE_RECORD);
}
buffer.writeInt(fileID);
buffer.writeByte(compactCount);
buffer.writeLong(txID);
buffer.writeInt(numberOfRecords);
if (transactionData != null) {
buffer.writeInt(transactionData.getEncodeSize());
}
if (transactionData != null) {
transactionData.encode(buffer);
}
buffer.writeInt(getEncodeSize());
}
示例2: testCloneFile
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Test
public void testCloneFile() throws Exception {
JDBCSequentialFile file = (JDBCSequentialFile) factory.createSequentialFile("test.txt");
file.open();
// Create buffer and fill with test data
int bufferSize = 1024;
ActiveMQBuffer src = ActiveMQBuffers.fixedBuffer(bufferSize);
for (int i = 0; i < bufferSize; i++) {
src.writeByte((byte) 5);
}
IOCallbackCountdown callback = new IOCallbackCountdown(1);
file.internalWrite(src, callback);
assertEquals(bufferSize, file.size());
JDBCSequentialFile copy = (JDBCSequentialFile) file.cloneFile();
copy.open();
assertEquals(bufferSize, copy.size());
assertEquals(bufferSize, file.size());
}
示例3: randomBuffer
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
public static ActiveMQBuffer randomBuffer(final int size, final long... data) {
ActiveMQBuffer buffer = ActiveMQBuffers.fixedBuffer(size + 8 * data.length);
for (long d : data) {
buffer.writeLong(d);
}
for (int i = 0; i < size; i++) {
buffer.writeByte(randomByte());
}
return buffer;
}
示例4: encode
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encode(ActiveMQBuffer buffer) {
buffer.writeByte(type.getType());
BufferHelper.writeAsSimpleString(buffer, name);
buffer.writeInt(bindings.size());
for (String bindingsEl : bindings) {
BufferHelper.writeAsSimpleString(buffer, bindingsEl);
}
}
示例5: encode
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encode(final ActiveMQBuffer buffer) {
buffer.writeByte(type.getType());
buffer.writeSimpleString(SimpleString.toSimpleString(name));
buffer.writeNullableSimpleString(SimpleString.toSimpleString(selector));
buffer.writeBoolean(durable);
}
示例6: encodeRest
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
buffer.writeLong(fileId);
if (fileId == -1)
return;
buffer.writeByte(fileType.code);
switch (fileType) {
case JOURNAL: {
buffer.writeByte(journalType.typeByte);
break;
}
case PAGE: {
buffer.writeSimpleString(pageStoreName);
break;
}
case LARGE_MESSAGE:
default:
// no-op
}
buffer.writeInt(dataSize);
/*
* sending -1 will close the file in case of a journal, but not in case of a largeMessage
* (which might receive appends)
*/
if (dataSize > 0) {
buffer.writeBytes(byteBuffer, 0, byteBuffer.writerIndex());
}
release();
}
示例7: encode
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encode(final ActiveMQBuffer buffer) {
buffer.writeByte(JournalImpl.ROLLBACK_RECORD);
buffer.writeInt(fileID);
buffer.writeByte(compactCount);
buffer.writeLong(txID);
buffer.writeInt(JournalImpl.SIZE_ROLLBACK_RECORD + 1);
}
示例8: encodeRest
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
buffer.writeByte(journalID);
buffer.writeLong(txId);
buffer.writeInt(encodingData.getEncodeSize());
encodingData.encode(buffer);
}
示例9: encode
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encode(final ActiveMQBuffer buffer) {
buffer.writeSimpleString(name);
buffer.writeSimpleString(address);
buffer.writeNullableSimpleString(filterString);
buffer.writeNullableSimpleString(createMetadata());
buffer.writeBoolean(autoCreated);
buffer.writeInt(maxConsumers);
buffer.writeBoolean(purgeOnNoConsumers);
buffer.writeByte(routingType);
}
示例10: 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);
}
}
示例11: testCreateBuffer
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Test
public void testCreateBuffer() throws Exception {
EmbeddedChannel channel = createChannel();
NettyConnection conn = new NettyConnection(emptyMap, channel, new MyListener(), false, false);
final int size = 1234;
ActiveMQBuffer buff = conn.createTransportBuffer(size);
buff.writeByte((byte) 0x00); // Netty buffer does lazy initialization.
Assert.assertEquals(size, buff.capacity());
}
示例12: encode
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
/** Sub classes must add the first short as the protocol-id */
@Override
public void encode(ActiveMQBuffer buffer, Message record) {
buffer.writeByte((byte)1);
buffer.writeLong(record.getMessageID());
buffer.writeNullableSimpleString(record.getAddressSimpleString());
record.persist(buffer);
}
示例13: encodeRest
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
buffer.writeSimpleString(address);
buffer.writeSimpleString(queueName);
buffer.writeNullableSimpleString(filterString);
buffer.writeBoolean(durable);
buffer.writeByte(routingType.getType());
buffer.writeBoolean(requiresResponse);
}
示例14: encodeRest
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
super.encodeRest(buffer);
buffer.writeBoolean(autoCreated);
buffer.writeBoolean(purgeOnNoConsumers);
buffer.writeByte(routingType.getType());
buffer.writeInt(maxConsumers);
}
示例15: encodeRest
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
buffer.writeSimpleString(address);
buffer.writeInt(routingTypes.size());
for (RoutingType routingType : routingTypes) {
buffer.writeByte(routingType.getType());
}
buffer.writeBoolean(requiresResponse);
buffer.writeBoolean(autoCreated);
}