[jboss-cvs] JBoss Messaging SVN: r5924 - in branches/JBMESSAGING_1394: src/main/org/jboss/messaging/core/client/impl and 38 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 24 21:48:18 EST 2009
Author: clebert.suconic at jboss.com
Date: 2009-02-24 21:48:17 -0500 (Tue, 24 Feb 2009)
New Revision: 5924
Added:
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/AbstractChannelBuffer.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/ChannelBuffer.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/ChannelBuffers.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/DynamicChannelBuffer.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/HeapChannelBuffer.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/SelfExpandingBufferTest.java
Modified:
branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/HttpClient.java
branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java
branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SSLClient.java
branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java
branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java
branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java
branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageImpl.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/paging/impl/PageTransactionInfoImpl.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/paging/impl/PagedMessageImpl.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/AbstractBufferHandler.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionResponseMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/MessagingExceptionMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketsConfirmedMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Ping.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Pong.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionResponseMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReplicateCreateSessionMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAcknowledgeMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAddDestinationMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerCloseMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionContinuationMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateQueueMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionExpiredMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionFailoverCompleteMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveContinuationMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionRemoveDestinationMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReplicateDeliveryMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXACommitMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAEndMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResponseMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/XidCodecSupport.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossTextMessage.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/util/TypedProperties.java
branches/JBMESSAGING_1394/src/main/org/jboss/messaging/util/UTF8Util.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/AutoGroupClientTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/SimpleTransformer.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/JustReplicationTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/consumer/ConsumerTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/http/NettyHttpTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/paging/PagingServiceIntegrationTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/DeadLetterAddressTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryAddressTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryRunnerTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/MessageGroupingTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueRecoveryTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/security/SimpleClient.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/wildcard/WildCardRoutingTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/SimpleEncoding.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreTestBase.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/remoting/MessagingBufferTestBase.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java
branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
Log:
just an operational backup
Modified: branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/HttpClient.java
===================================================================
--- branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/HttpClient.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/HttpClient.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -53,12 +53,12 @@
SimpleString queue = new SimpleString("queuejms.testQueue");
ClientProducer clientProducer = clientSession.createProducer(queue);
ClientMessage message = clientSession.createClientMessage(false);
- message.getBody().putString("Hello!");
+ message.getBody().writeString("Hello!");
clientProducer.send(message);
ClientConsumer clientConsumer = clientSession.createConsumer(queue);
clientSession.start();
ClientMessage msg = clientConsumer.receive(5000);
- System.out.println("msg.getPayload() = " + msg.getBody().getString());
+ System.out.println("msg.getPayload() = " + msg.getBody().readString());
msg.acknowledge();
}
catch(Exception e)
Modified: branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java
===================================================================
--- branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -192,7 +192,7 @@
{
ClientProducer clientProducer = clientSession.createProducer(queue);
ClientMessage message = clientSession.createClientMessage(false);
- message.getBody().putString("Hello, World!");
+ message.getBody().writeString("Hello, World!");
clientProducer.send(message);
clientProducer.send(message);
clientProducer.send(message);
Modified: branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SSLClient.java
===================================================================
--- branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SSLClient.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SSLClient.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -51,13 +51,13 @@
SimpleString queue = new SimpleString("queuejms.testQueue");
ClientProducer clientProducer = clientSession.createProducer(queue);
ClientMessage message = clientSession.createClientMessage(false);
- message.getBody().putString("Hello!");
+ message.getBody().writeString("Hello!");
clientProducer.send(message);
ClientConsumer clientConsumer = clientSession.createConsumer(queue);
clientSession.start();
ClientMessage msg = clientConsumer.receive(5000);
msg.acknowledge();
- System.out.println("msg.getPayload() = " + msg.getBody().getString());
+ System.out.println("msg.getPayload() = " + msg.getBody().readString());
}
catch(Exception e)
{
Modified: branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java
===================================================================
--- branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/ScheduledMessageExample.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -55,7 +55,7 @@
SimpleString queue = new SimpleString("queuejms.testQueue");
ClientProducer clientProducer = clientSession.createProducer(queue);
ClientMessage message = clientSession.createClientMessage(false);
- message.getBody().putString("Hello!");
+ message.getBody().writeString("Hello!");
Calendar cal = Calendar.getInstance();
log.info("current time " + df.format(cal.getTime()));
cal.add(Calendar.SECOND, 5);
Modified: branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java
===================================================================
--- branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -51,12 +51,12 @@
SimpleString queue = new SimpleString("queuejms.testQueue");
ClientProducer clientProducer = clientSession.createProducer(queue);
ClientMessage message = clientSession.createClientMessage(JBossTextMessage.TYPE, false);
- message.getBody().putString("Hello!");
+ message.getBody().writeString("Hello!");
clientProducer.send(message);
ClientConsumer clientConsumer = clientSession.createConsumer(queue);
clientSession.start();
ClientMessage msg = clientConsumer.receive(5000);
- System.out.println("msg.getPayload() = " + msg.getBody().getString());
+ System.out.println("msg.getPayload() = " + msg.getBody().readString());
msg.acknowledge();
}
catch(Exception e)
Modified: branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java
===================================================================
--- branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/SimpleExample.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -63,13 +63,13 @@
clientSession.createQueue(atestq, atestq, null, false, true);
ClientProducer clientProducer = clientSession.createProducer(atestq);
ClientMessage message = clientSession.createClientMessage(false);
- message.getBody().putString("Hello!");
+ message.getBody().writeString("Hello!");
clientProducer.send(message);
ClientConsumer clientConsumer = clientSession.createConsumer(atestq);
clientSession.start();
ClientMessage msg = clientConsumer.receive(5000);
msg.acknowledge();
- System.out.println("msg.getPayload() = " + msg.getBody().getString());
+ System.out.println("msg.getPayload() = " + msg.getBody().readString());
}
catch (Exception e)
{
Modified: branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java
===================================================================
--- branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/examples/messaging/src/org/jboss/messaging/example/WildCardClient.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -55,9 +55,9 @@
ClientProducer clientProducer = clientSession.createProducer(queue);
ClientProducer clientProducer2 = clientSession.createProducer(queue2);
ClientMessage message = clientSession.createClientMessage(false);
- message.getBody().putString("This is a message from queue " + queue);
+ message.getBody().writeString("This is a message from queue " + queue);
ClientMessage message2 = clientSession.createClientMessage(false);
- message2.getBody().putString("This is a message from queue " + queue2);
+ message2.getBody().writeString("This is a message from queue " + queue2);
clientSession.createQueue(wildCardQ, wildCardQ, null, false, true);
clientConsumer = clientSession.createConsumer(wildCardQ);
@@ -68,10 +68,10 @@
clientSession.start();
ClientMessage msg = clientConsumer.receive(5000);
msg.acknowledge();
- log.info("message received: " + msg.getBody().getString());
+ log.info("message received: " + msg.getBody().readString());
ClientMessage msg2 = clientConsumer.receive(5000);
msg2.acknowledge();
- log.info("message received: " + msg2.getBody().getString());
+ log.info("message received: " + msg2.getBody().readString());
}
catch (Exception e)
{
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientConsumerImpl.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -378,10 +378,10 @@
if (currentBody != null)
{
- newBody.putBytes(currentBody.array());
+ newBody.writeBytes(currentBody.array());
}
- newBody.putBytes(body.array());
+ newBody.writeBytes(body.array());
currentChunkMessage.setBody(newBody);
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageImpl.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageImpl.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientFileMessageImpl.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -133,7 +133,7 @@
channel.position(0);
channel.read(fileBuffer);
- buffer.putBytes(fileBuffer.array(), 0, fileBuffer.limit());
+ buffer.writeBytes(fileBuffer.array(), 0, fileBuffer.limit());
}
catch (Exception e)
{
@@ -167,7 +167,7 @@
channel.position(start);
channel.read(bufferRead);
- buffer.putBytes(bufferRead.array());
+ buffer.writeBytes(bufferRead.array());
}
catch (Exception e)
{
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -48,6 +48,7 @@
import org.jboss.messaging.core.remoting.FailureListener;
import org.jboss.messaging.core.remoting.Packet;
import org.jboss.messaging.core.remoting.RemotingConnection;
+import org.jboss.messaging.core.remoting.impl.ExpandingMessagingBuffer;
import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
import org.jboss.messaging.core.remoting.impl.wireformat.ReattachSessionMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.ReattachSessionResponseMessage;
@@ -590,7 +591,7 @@
public ClientMessage createClientMessage(final boolean durable)
{
- MessagingBuffer body = remotingConnection.createBuffer(INITIAL_MESSAGE_BODY_SIZE);
+ MessagingBuffer body = new ExpandingMessagingBuffer(INITIAL_MESSAGE_BODY_SIZE);
return new ClientMessageImpl(durable, body);
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -307,13 +307,13 @@
ByteBufferWrapper bb = new ByteBufferWrapper(newBuffer(size));
- bb.putByte(ADD_RECORD);
- bb.putInt(-1); // skip ID part
- bb.putLong(id);
- bb.putInt(recordLength);
- bb.putByte(recordType);
+ bb.writeByte(ADD_RECORD);
+ bb.writeInt(-1); // skip ID part
+ bb.writeLong(id);
+ bb.writeInt(recordLength);
+ bb.writeByte(recordType);
record.encode(bb);
- bb.putInt(size);
+ bb.writeInt(size);
try
{
@@ -357,13 +357,13 @@
ByteBufferWrapper bb = new ByteBufferWrapper(newBuffer(size));
- bb.putByte(UPDATE_RECORD);
- bb.putInt(-1); // skip ID part
- bb.putLong(id);
- bb.putInt(record.getEncodeSize());
- bb.putByte(recordType);
+ bb.writeByte(UPDATE_RECORD);
+ bb.writeInt(-1); // skip ID part
+ bb.writeLong(id);
+ bb.writeInt(record.getEncodeSize());
+ bb.writeByte(recordType);
record.encode(bb);
- bb.putInt(size);
+ bb.writeInt(size);
try
{
@@ -448,14 +448,14 @@
ByteBufferWrapper bb = new ByteBufferWrapper(newBuffer(size));
- bb.putByte(ADD_RECORD_TX);
- bb.putInt(-1); // skip ID part
- bb.putLong(txID);
- bb.putLong(id);
- bb.putInt(recordLength);
- bb.putByte(recordType);
+ bb.writeByte(ADD_RECORD_TX);
+ bb.writeInt(-1); // skip ID part
+ bb.writeLong(txID);
+ bb.writeLong(id);
+ bb.writeInt(recordLength);
+ bb.writeByte(recordType);
record.encode(bb);
- bb.putInt(size);
+ bb.writeInt(size);
try
{
@@ -500,14 +500,14 @@
ByteBufferWrapper bb = new ByteBufferWrapper(newBuffer(size));
- bb.putByte(UPDATE_RECORD_TX);
- bb.putInt(-1); // skip ID part
- bb.putLong(txID);
- bb.putLong(id);
- bb.putInt(record.getEncodeSize());
- bb.putByte(recordType);
+ bb.writeByte(UPDATE_RECORD_TX);
+ bb.writeInt(-1); // skip ID part
+ bb.writeLong(txID);
+ bb.writeLong(id);
+ bb.writeInt(record.getEncodeSize());
+ bb.writeByte(recordType);
record.encode(bb);
- bb.putInt(size);
+ bb.writeInt(size);
try
{
@@ -546,16 +546,16 @@
ByteBufferWrapper bb = new ByteBufferWrapper(newBuffer(size));
- bb.putByte(DELETE_RECORD_TX);
- bb.putInt(-1); // skip ID part
- bb.putLong(txID);
- bb.putLong(id);
- bb.putInt(record != null ? record.getEncodeSize() : 0);
+ bb.writeByte(DELETE_RECORD_TX);
+ bb.writeInt(-1); // skip ID part
+ bb.writeLong(txID);
+ bb.writeLong(id);
+ bb.writeInt(record != null ? record.getEncodeSize() : 0);
if (record != null)
{
record.encode(bb);
}
- bb.putInt(size);
+ bb.writeInt(size);
try
{
@@ -589,12 +589,12 @@
ByteBufferWrapper bb = new ByteBufferWrapper(newBuffer(size));
- bb.putByte(DELETE_RECORD_TX);
- bb.putInt(-1); // skip ID part
- bb.putLong(txID);
- bb.putLong(id);
- bb.putInt(0);
- bb.putInt(size);
+ bb.writeByte(DELETE_RECORD_TX);
+ bb.writeInt(-1); // skip ID part
+ bb.writeLong(txID);
+ bb.writeLong(id);
+ bb.writeInt(0);
+ bb.writeInt(size);
try
{
@@ -2641,7 +2641,7 @@
public void encode(final MessagingBuffer buffer)
{
- buffer.putBytes(data);
+ buffer.writeBytes(data);
}
public int getEncodeSize()
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/message/impl/MessageImpl.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -157,7 +157,7 @@
public void encode(final MessagingBuffer buffer)
{
encodeProperties(buffer);
- buffer.putInt(getBodySize());
+ buffer.writeInt(getBodySize());
encodeBody(buffer);
}
@@ -184,26 +184,26 @@
public void encodeProperties(MessagingBuffer buffer)
{
- buffer.putLong(messageID);
- buffer.putSimpleString(destination);
- buffer.putByte(type);
- buffer.putBoolean(durable);
- buffer.putLong(expiration);
- buffer.putLong(timestamp);
- buffer.putByte(priority);
+ buffer.writeLong(messageID);
+ buffer.writeSimpleString(destination);
+ buffer.writeByte(type);
+ buffer.writeBoolean(durable);
+ buffer.writeLong(expiration);
+ buffer.writeLong(timestamp);
+ buffer.writeByte(priority);
properties.encode(buffer);
}
public void encodeBody(MessagingBuffer buffer)
{
MessagingBuffer localBody = getBody();
- buffer.putBytes(localBody.array(), 0, localBody.limit());
+ buffer.writeBytes(localBody.array(), 0, localBody.limit());
}
// Used on Message chunk
public void encodeBody(MessagingBuffer buffer, long start, int size)
{
- buffer.putBytes(body.array(), (int)start, size);
+ buffer.writeBytes(body.array(), (int)start, size);
}
public void decode(final MessagingBuffer buffer)
@@ -215,24 +215,24 @@
public void decodeProperties(final MessagingBuffer buffer)
{
- messageID = buffer.getLong();
- destination = buffer.getSimpleString();
- type = buffer.getByte();
- durable = buffer.getBoolean();
- expiration = buffer.getLong();
- timestamp = buffer.getLong();
- priority = buffer.getByte();
+ messageID = buffer.readLong();
+ destination = buffer.readSimpleString();
+ type = buffer.readByte();
+ durable = buffer.readBoolean();
+ expiration = buffer.readLong();
+ timestamp = buffer.readLong();
+ priority = buffer.readByte();
properties.decode(buffer);
}
public void decodeBody(final MessagingBuffer buffer)
{
- int len = buffer.getInt();
+ int len = buffer.readInt();
// TODO - this can be optimised
byte[] bytes = new byte[len];
- buffer.getBytes(bytes);
+ buffer.readBytes(bytes);
body = buffer.createNewBuffer(len);
- body.putBytes(bytes);
+ body.writeBytes(bytes);
}
public long getMessageID()
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/paging/impl/PageTransactionInfoImpl.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/paging/impl/PageTransactionInfoImpl.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/paging/impl/PageTransactionInfoImpl.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -111,8 +111,8 @@
public synchronized void decode(final MessagingBuffer buffer)
{
- transactionID = buffer.getLong();
- numberOfMessages.set(buffer.getInt());
+ transactionID = buffer.readLong();
+ numberOfMessages.set(buffer.readInt());
countDownCompleted = null; // if it is being readed, probably it was
// committed
committed = true; // Unless it is a incomplete prepare, which is marked by
@@ -121,8 +121,8 @@
public synchronized void encode(final MessagingBuffer buffer)
{
- buffer.putLong(transactionID);
- buffer.putInt(numberOfMessages.get());
+ buffer.writeLong(transactionID);
+ buffer.writeInt(numberOfMessages.get());
}
public synchronized int getEncodeSize()
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/paging/impl/PagedMessageImpl.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/paging/impl/PagedMessageImpl.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/paging/impl/PagedMessageImpl.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -100,21 +100,21 @@
public void decode(final MessagingBuffer buffer)
{
- transactionID = buffer.getLong();
+ transactionID = buffer.readLong();
- boolean isLargeMessage = buffer.getBoolean();
+ boolean isLargeMessage = buffer.readBoolean();
if (isLargeMessage)
{
- int largeMessageHeaderSize = buffer.getInt();
+ int largeMessageHeaderSize = buffer.readInt();
largeMessageLazyData = new byte[largeMessageHeaderSize];
- buffer.getBytes(largeMessageLazyData);
+ buffer.readBytes(largeMessageLazyData);
}
else
{
- buffer.getInt(); // This value is only used on LargeMessages for now
+ buffer.readInt(); // This value is only used on LargeMessages for now
message = new ServerMessageImpl();
@@ -125,11 +125,11 @@
public void encode(final MessagingBuffer buffer)
{
- buffer.putLong(transactionID);
+ buffer.writeLong(transactionID);
- buffer.putBoolean(message instanceof LargeServerMessage);
+ buffer.writeBoolean(message instanceof LargeServerMessage);
- buffer.putInt(message.getEncodeSize());
+ buffer.writeInt(message.getEncodeSize());
message.encode(buffer);
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalLargeServerMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -132,7 +132,7 @@
if (bytesRead > 0)
{
- bufferOut.putBytes(bufferRead.array(), 0, bytesRead);
+ bufferOut.writeBytes(bufferRead.array(), 0, bytesRead);
}
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -1217,16 +1217,16 @@
public void decode(final MessagingBuffer buffer)
{
- name = buffer.getSimpleString();
- address = buffer.getSimpleString();
- filterString = buffer.getNullableSimpleString();
+ name = buffer.readSimpleString();
+ address = buffer.readSimpleString();
+ filterString = buffer.readNullableSimpleString();
}
public void encode(final MessagingBuffer buffer)
{
- buffer.putSimpleString(name);
- buffer.putSimpleString(address);
- buffer.putNullableSimpleString(filterString);
+ buffer.writeSimpleString(name);
+ buffer.writeSimpleString(address);
+ buffer.writeNullableSimpleString(filterString);
}
public int getEncodeSize()
@@ -1251,12 +1251,12 @@
public void decode(final MessagingBuffer buffer)
{
- destination = buffer.getSimpleString();
+ destination = buffer.readSimpleString();
}
public void encode(final MessagingBuffer buffer)
{
- buffer.putSimpleString(destination);
+ buffer.writeSimpleString(destination);
}
public int getEncodeSize()
@@ -1283,14 +1283,14 @@
{
byte[] bytes = new byte[16];
- buffer.getBytes(bytes);
+ buffer.readBytes(bytes);
uuid = new UUID(UUID.TYPE_TIME_BASED, bytes);
}
public void encode(final MessagingBuffer buffer)
{
- buffer.putBytes(uuid.asBytes());
+ buffer.writeBytes(uuid.asBytes());
}
public int getEncodeSize()
@@ -1355,14 +1355,14 @@
public void decode(final MessagingBuffer buffer)
{
- queueID = buffer.getLong();
- count = buffer.getInt();
+ queueID = buffer.readLong();
+ count = buffer.readInt();
}
public void encode(final MessagingBuffer buffer)
{
- buffer.putLong(queueID);
- buffer.putInt(count);
+ buffer.writeLong(queueID);
+ buffer.writeInt(count);
}
public int getEncodeSize()
@@ -1388,12 +1388,12 @@
public void decode(final MessagingBuffer buffer)
{
- queueID = buffer.getLong();
+ queueID = buffer.readLong();
}
public void encode(final MessagingBuffer buffer)
{
- buffer.putLong(queueID);
+ buffer.writeLong(queueID);
}
public int getEncodeSize()
@@ -1451,13 +1451,13 @@
public void encode(MessagingBuffer buffer)
{
super.encode(buffer);
- buffer.putLong(scheduledDeliveryTime);
+ buffer.writeLong(scheduledDeliveryTime);
}
public void decode(MessagingBuffer buffer)
{
super.decode(buffer);
- scheduledDeliveryTime = buffer.getLong();
+ scheduledDeliveryTime = buffer.readLong();
}
}
@@ -1480,22 +1480,22 @@
public void decode(final MessagingBuffer buffer)
{
- address = buffer.getSimpleString();
+ address = buffer.readSimpleString();
- int size = buffer.getInt();
+ int size = buffer.readInt();
duplID = new byte[size];
- buffer.getBytes(duplID);
+ buffer.readBytes(duplID);
}
public void encode(final MessagingBuffer buffer)
{
- buffer.putSimpleString(address);
+ buffer.writeSimpleString(address);
- buffer.putInt(duplID.length);
+ buffer.writeInt(duplID.length);
- buffer.putBytes(duplID);
+ buffer.writeBytes(duplID);
}
public int getEncodeSize()
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageLargeServerMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -83,7 +83,7 @@
setBody(buffer);
}
- buffer.putBytes(bytes);
+ buffer.writeBytes(bytes);
}
/* (non-Javadoc)
Added: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/AbstractChannelBuffer.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/AbstractChannelBuffer.java (rev 0)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/AbstractChannelBuffer.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -0,0 +1,594 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.remoting.buffers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.GatheringByteChannel;
+import java.nio.channels.ScatteringByteChannel;
+
+/**
+ * A skeletal implementation of a buffer.
+ *
+ * @author The Netty Project (netty-dev at lists.jboss.org)
+ * @author Trustin Lee (tlee at redhat.com)
+ *
+ * @version $Rev: 303 $, $Date: 2008-09-24 18:48:32 +0900 (Wed, 24 Sep 2008) $
+ */
+public abstract class AbstractChannelBuffer implements ChannelBuffer
+{
+
+ private int readerIndex;
+
+ private int writerIndex;
+
+ private int markedReaderIndex;
+
+ private int markedWriterIndex;
+
+ public int readerIndex()
+ {
+ return readerIndex;
+ }
+
+ public void readerIndex(int readerIndex)
+ {
+ if (readerIndex < 0 || readerIndex > writerIndex)
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ this.readerIndex = readerIndex;
+ }
+
+ public int writerIndex()
+ {
+ return writerIndex;
+ }
+
+ public void writerIndex(int writerIndex)
+ {
+ if (writerIndex < readerIndex || writerIndex > capacity())
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ this.writerIndex = writerIndex;
+ }
+
+ public void setIndex(int readerIndex, int writerIndex)
+ {
+ if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity())
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ this.readerIndex = readerIndex;
+ this.writerIndex = writerIndex;
+ }
+
+ public void clear()
+ {
+ readerIndex = writerIndex = 0;
+ }
+
+ public boolean readable()
+ {
+ return readableBytes() > 0;
+ }
+
+ public boolean writable()
+ {
+ return writableBytes() > 0;
+ }
+
+ public int readableBytes()
+ {
+ return writerIndex - readerIndex;
+ }
+
+ public int writableBytes()
+ {
+ return capacity() - writerIndex;
+ }
+
+ public void markReaderIndex()
+ {
+ markedReaderIndex = readerIndex;
+ }
+
+ public void resetReaderIndex()
+ {
+ readerIndex(markedReaderIndex);
+ }
+
+ public void markWriterIndex()
+ {
+ markedWriterIndex = writerIndex;
+ }
+
+ public void resetWriterIndex()
+ {
+ writerIndex = markedWriterIndex;
+ }
+
+ public void discardReadBytes()
+ {
+ if (readerIndex == 0)
+ {
+ return;
+ }
+ setBytes(0, this, readerIndex, writerIndex - readerIndex);
+ writerIndex -= readerIndex;
+ markedReaderIndex = Math.max(markedReaderIndex - readerIndex, 0);
+ markedWriterIndex = Math.max(markedWriterIndex - readerIndex, 0);
+ readerIndex = 0;
+ }
+
+ public short getUnsignedByte(int index)
+ {
+ return (short)(getByte(index) & 0xFF);
+ }
+
+ public int getUnsignedShort(int index)
+ {
+ return getShort(index) & 0xFFFF;
+ }
+
+ public int getMedium(int index)
+ {
+ int value = getUnsignedMedium(index);
+ if ((value & 0x800000) != 0)
+ {
+ value |= 0xff000000;
+ }
+ return value;
+ }
+
+ public long getUnsignedInt(int index)
+ {
+ return getInt(index) & 0xFFFFFFFFL;
+ }
+
+ public void getBytes(int index, byte[] dst)
+ {
+ getBytes(index, dst, 0, dst.length);
+ }
+
+ public void getBytes(int index, ChannelBuffer dst)
+ {
+ getBytes(index, dst, dst.writableBytes());
+ }
+
+ public void getBytes(int index, ChannelBuffer dst, int length)
+ {
+ if (length > dst.writableBytes())
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ getBytes(index, dst, dst.writerIndex(), length);
+ dst.writerIndex(dst.writerIndex() + length);
+ }
+
+ public void setBytes(int index, byte[] src)
+ {
+ setBytes(index, src, 0, src.length);
+ }
+
+ public void setBytes(int index, ChannelBuffer src)
+ {
+ setBytes(index, src, src.readableBytes());
+ }
+
+ public void setBytes(int index, ChannelBuffer src, int length)
+ {
+ if (length > src.readableBytes())
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ setBytes(index, src, src.readerIndex(), length);
+ src.readerIndex(src.readerIndex() + length);
+ }
+
+ public void setZero(int index, int length)
+ {
+ if (length == 0)
+ {
+ return;
+ }
+ if (length < 0)
+ {
+ throw new IllegalArgumentException("length must be 0 or greater than 0.");
+ }
+
+ int nLong = length >>> 3;
+ int nBytes = length & 7;
+ for (int i = nLong; i > 0; i--)
+ {
+ setLong(index, 0);
+ index += 8;
+ }
+ if (nBytes == 4)
+ {
+ setInt(index, 0);
+ }
+ else if (nBytes < 4)
+ {
+ for (int i = nBytes; i > 0; i--)
+ {
+ setByte(index, (byte)0);
+ index++;
+ }
+ }
+ else
+ {
+ setInt(index, 0);
+ index += 4;
+ for (int i = nBytes - 4; i > 0; i--)
+ {
+ setByte(index, (byte)0);
+ index++;
+ }
+ }
+ }
+
+ public byte readByte()
+ {
+ if (readerIndex == writerIndex)
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ return getByte(readerIndex++);
+ }
+
+ public short readUnsignedByte()
+ {
+ return (short)(readByte() & 0xFF);
+ }
+
+ public short readShort()
+ {
+ checkReadableBytes(2);
+ short v = getShort(readerIndex);
+ readerIndex += 2;
+ return v;
+ }
+
+ public int readUnsignedShort()
+ {
+ return readShort() & 0xFFFF;
+ }
+
+ public int readMedium()
+ {
+ int value = readUnsignedMedium();
+ if ((value & 0x800000) != 0)
+ {
+ value |= 0xff000000;
+ }
+ return value;
+ }
+
+ public int readUnsignedMedium()
+ {
+ checkReadableBytes(3);
+ int v = getUnsignedMedium(readerIndex);
+ readerIndex += 3;
+ return v;
+ }
+
+ public int readInt()
+ {
+ checkReadableBytes(4);
+ int v = getInt(readerIndex);
+ readerIndex += 4;
+ return v;
+ }
+
+ public long readUnsignedInt()
+ {
+ return readInt() & 0xFFFFFFFFL;
+ }
+
+ public long readLong()
+ {
+ checkReadableBytes(8);
+ long v = getLong(readerIndex);
+ readerIndex += 8;
+ return v;
+ }
+
+ public ChannelBuffer readBytes(int length)
+ {
+ checkReadableBytes(length);
+ if (length == 0)
+ {
+ return ChannelBuffers.EMPTY_BUFFER;
+ }
+ ChannelBuffer buf = ChannelBuffers.buffer(length);
+ buf.writeBytes(this, readerIndex, length);
+ readerIndex += length;
+ return buf;
+ }
+
+ public void readBytes(byte[] dst, int dstIndex, int length)
+ {
+ checkReadableBytes(length);
+ getBytes(readerIndex, dst, dstIndex, length);
+ readerIndex += length;
+ }
+
+ public void readBytes(byte[] dst)
+ {
+ readBytes(dst, 0, dst.length);
+ }
+
+ public void readBytes(ChannelBuffer dst)
+ {
+ readBytes(dst, dst.writableBytes());
+ }
+
+ public void readBytes(ChannelBuffer dst, int length)
+ {
+ if (length > dst.writableBytes())
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ readBytes(dst, dst.writerIndex(), length);
+ dst.writerIndex(dst.writerIndex() + length);
+ }
+
+ public void readBytes(ChannelBuffer dst, int dstIndex, int length)
+ {
+ checkReadableBytes(length);
+ getBytes(readerIndex, dst, dstIndex, length);
+ readerIndex += length;
+ }
+
+ public void readBytes(ByteBuffer dst)
+ {
+ int length = dst.remaining();
+ checkReadableBytes(length);
+ getBytes(readerIndex, dst);
+ readerIndex += length;
+ }
+
+ public int readBytes(GatheringByteChannel out, int length) throws IOException
+ {
+ checkReadableBytes(length);
+ int readBytes = getBytes(readerIndex, out, length);
+ readerIndex += readBytes;
+ return readBytes;
+ }
+
+ public void readBytes(OutputStream out, int length) throws IOException
+ {
+ checkReadableBytes(length);
+ getBytes(readerIndex, out, length);
+ readerIndex += length;
+ }
+
+ public void skipBytes(int length)
+ {
+ int newReaderIndex = readerIndex + length;
+ if (newReaderIndex > writerIndex)
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ readerIndex = newReaderIndex;
+ }
+
+ public void writeByte(byte value)
+ {
+ setByte(writerIndex++, value);
+ }
+
+ public void writeShort(short value)
+ {
+ setShort(writerIndex, value);
+ writerIndex += 2;
+ }
+
+ public void writeMedium(int value)
+ {
+ setMedium(writerIndex, value);
+ writerIndex += 3;
+ }
+
+ public void writeInt(int value)
+ {
+ setInt(writerIndex, value);
+ writerIndex += 4;
+ }
+
+ public void writeLong(long value)
+ {
+ setLong(writerIndex, value);
+ writerIndex += 8;
+ }
+
+ public void writeBytes(byte[] src, int srcIndex, int length)
+ {
+ setBytes(writerIndex, src, srcIndex, length);
+ writerIndex += length;
+ }
+
+ public void writeBytes(byte[] src)
+ {
+ writeBytes(src, 0, src.length);
+ }
+
+ public void writeBytes(ChannelBuffer src)
+ {
+ writeBytes(src, src.readableBytes());
+ }
+
+ public void writeBytes(ChannelBuffer src, int length)
+ {
+ if (length > src.readableBytes())
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ writeBytes(src, src.readerIndex(), length);
+ src.readerIndex(src.readerIndex() + length);
+ }
+
+ public void writeBytes(ChannelBuffer src, int srcIndex, int length)
+ {
+ setBytes(writerIndex, src, srcIndex, length);
+ writerIndex += length;
+ }
+
+ public void writeBytes(ByteBuffer src)
+ {
+ int length = src.remaining();
+ setBytes(writerIndex, src);
+ writerIndex += length;
+ }
+
+ public void writeBytes(InputStream in, int length) throws IOException
+ {
+ setBytes(writerIndex, in, length);
+ writerIndex += length;
+ }
+
+ public int writeBytes(ScatteringByteChannel in, int length) throws IOException
+ {
+ int writtenBytes = setBytes(writerIndex, in, length);
+ if (writtenBytes > 0)
+ {
+ writerIndex += writtenBytes;
+ }
+ return writtenBytes;
+ }
+
+ public void writeZero(int length)
+ {
+ if (length == 0)
+ {
+ return;
+ }
+ if (length < 0)
+ {
+ throw new IllegalArgumentException("length must be 0 or greater than 0.");
+ }
+ int nLong = length >>> 3;
+ int nBytes = length & 7;
+ for (int i = nLong; i > 0; i--)
+ {
+ writeLong(0);
+ }
+ if (nBytes == 4)
+ {
+ writeInt(0);
+ }
+ else if (nBytes < 4)
+ {
+ for (int i = nBytes; i > 0; i--)
+ {
+ writeByte((byte)0);
+ }
+ }
+ else
+ {
+ writeInt(0);
+ for (int i = nBytes - 4; i > 0; i--)
+ {
+ writeByte((byte)0);
+ }
+ }
+ }
+
+ public ByteBuffer toByteBuffer()
+ {
+ return toByteBuffer(readerIndex, readableBytes());
+ }
+
+ public ByteBuffer[] toByteBuffers()
+ {
+ return toByteBuffers(readerIndex, readableBytes());
+ }
+
+ public ByteBuffer[] toByteBuffers(int index, int length)
+ {
+ return new ByteBuffer[] { toByteBuffer(index, length) };
+ }
+
+ public String toString(String charsetName)
+ {
+ return toString(readerIndex, readableBytes(), charsetName);
+ }
+
+ public int indexOf(int fromIndex, int toIndex, byte value)
+ {
+ return ChannelBuffers.indexOf(this, fromIndex, toIndex, value);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ChannelBuffers.hashCode(this);
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof ChannelBuffer))
+ {
+ return false;
+ }
+ return ChannelBuffers.equals(this, (ChannelBuffer)o);
+ }
+
+ public int compareTo(ChannelBuffer that)
+ {
+ return ChannelBuffers.compare(this, that);
+ }
+
+ @Override
+ public String toString()
+ {
+ return getClass().getSimpleName() + '(' +
+ "ridx=" +
+ readerIndex +
+ ", " +
+ "widx=" +
+ writerIndex +
+ ", " +
+ "cap=" +
+ capacity() +
+ ')';
+ }
+
+ /**
+ * Throws an {@link IndexOutOfBoundsException} if the current
+ * {@linkplain #readableBytes() readable bytes} of this buffer is less
+ * than the specified value.
+ */
+ protected void checkReadableBytes(int minimumReadableBytes)
+ {
+ if (readableBytes() < minimumReadableBytes)
+ {
+ throw new IndexOutOfBoundsException();
+ }
+ }
+}
Added: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/ChannelBuffer.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/ChannelBuffer.java (rev 0)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/ChannelBuffer.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -0,0 +1,1282 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.messaging.core.remoting.buffers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.GatheringByteChannel;
+import java.nio.channels.ScatteringByteChannel;
+import java.nio.charset.UnsupportedCharsetException;
+import java.util.NoSuchElementException;
+
+import org.jboss.netty.buffer.ChannelBufferInputStream;
+import org.jboss.netty.buffer.ChannelBufferOutputStream;
+
+
+/**
+ * A random and sequential accessible sequence of zero or more bytes (octets).
+ * This interface provides an abstract view for one or more primitive byte
+ * arrays ({@code byte[]}) and {@linkplain ByteBuffer NIO buffers}.
+ *
+ * <h3>Creation of a buffer</h3>
+ *
+ * It is recommended to create a new buffer using the helper methods in
+ * {@link ChannelBuffers} rather than calling an individual implementation's
+ * constructor.
+ *
+ * <h3>Random Access Indexing</h3>
+ *
+ * Just like an ordinary primitive byte array, {@link ChannelBuffer} uses
+ * <a href="http://en.wikipedia.org/wiki/Index_(information_technology)#Array_element_identifier">zero-based indexing</a>.
+ * It means the index of the first byte is always {@code 0} and the index of
+ * the last byte is always {@link #capacity() capacity - 1}. For example, to
+ * iterate all bytes of a buffer, you can do the following, regardless of
+ * its internal implementation:
+ *
+ * <pre>
+ * ChannelBuffer buffer = ...;
+ * for (int i = 0; i < buffer.capacity(); i ++</strong>) {
+ * byte b = array.getByte(i);
+ * System.out.println((char) b);
+ * }
+ * </pre>
+ *
+ * <h3>Sequential Access Indexing</h3>
+ *
+ * {@link ChannelBuffer} provides two pointer variables to support sequential
+ * read and write operations - {@link #readerIndex() readerIndex} for a read
+ * operation and {@link #writerIndex() writerIndex} for a write operation
+ * respectively. The following diagram shows how a buffer is segmented into
+ * three areas by the two pointers:
+ *
+ * <pre>
+ * +-------------------+------------------+------------------+
+ * | discardable bytes | readable bytes | writable bytes |
+ * | | (CONTENT) | |
+ * +-------------------+------------------+------------------+
+ * | | | |
+ * 0 <= readerIndex <= writerIndex <= capacity
+ * </pre>
+ *
+ * <h4>Readable bytes (the actual content)</h4>
+ *
+ * This segment is where the actual data is stored. Any operation whose name
+ * starts with {@code read} or {@code skip} will get or skip the data at the
+ * current {@link #readerIndex() readerIndex} and increase it by the number of
+ * read bytes. If the argument of the read operation is also a
+ * {@link ChannelBuffer} and no start index is specified, the specified
+ * buffer's {@link #readerIndex() readerIndex} is increased together.
+ * <p>
+ * If there's not enough content left, {@link IndexOutOfBoundsException} is
+ * raised. The default value of newly allocated, wrapped or copied buffer's
+ * {@link #readerIndex() readerIndex} is {@code 0}.
+ *
+ * <pre>
+ * // Iterates the readable bytes of a buffer.
+ * ChannelBuffer buffer = ...;
+ * while (buffer.readable()) {
+ * System.out.println(buffer.readByte());
+ * }
+ * </pre>
+ *
+ * <h4>Writable bytes</h4>
+ *
+ * This segment is a undefined space which needs to be filled. Any operation
+ * whose name ends with {@code write} will write the data at the current
+ * {@link #writerIndex() writerIndex} and increase it by the number of written
+ * bytes. If the argument of the write operation is also a {@link ChannelBuffer},
+ * and no start index is specified, the specified buffer's
+ * {@link #readerIndex() readerIndex} is increased together.
+ * <p>
+ * If there's not enough writable bytes left, {@link IndexOutOfBoundsException}
+ * is raised. The default value of newly allocated buffer's
+ * {@link #writerIndex() writerIndex} is {@code 0}. The default value of
+ * wrapped or copied buffer's {@link #writerIndex() writerIndex} is the
+ * {@link #capacity() capacity} of the buffer.
+ *
+ * <pre>
+ * // Fills the writable bytes of a buffer with random integers.
+ * ChannelBuffer buffer = ...;
+ * while (buffer.writableBytes() >= 4) {
+ * buffer.writeInt(random.nextInt());
+ * }
+ * </pre>
+ *
+ * <h4>Discardable bytes</h4>
+ *
+ * This segment contains the bytes which were read already by a read operation.
+ * Initially, the size of this segment is {@code 0}, but its size increases up
+ * to the {@link #writerIndex() writerIndex} as read operations are executed.
+ * The read bytes can be discarded by calling {@link #discardReadBytes()} to
+ * reclaim unused area as depicted by the following diagram:
+ *
+ * <pre>
+ * BEFORE discardReadBytes()
+ *
+ * +-------------------+------------------+------------------+
+ * | discardable bytes | readable bytes | writable bytes |
+ * +-------------------+------------------+------------------+
+ * | | | |
+ * 0 <= readerIndex <= writerIndex <= capacity
+ *
+ *
+ * AFTER discardReadBytes()
+ *
+ * +------------------+--------------------------------------+
+ * | readable bytes | writable bytes (got more space) |
+ * +------------------+--------------------------------------+
+ * | | |
+ * readerIndex (0) <= writerIndex (decreased) <= capacity
+ * </pre>
+ *
+ * <h4>Clearing the buffer indexes</h4>
+ *
+ * You can set both {@link #readerIndex() readerIndex} and
+ * {@link #writerIndex() writerIndex} to {@code 0} by calling {@link #clear()}.
+ * It does not clear the buffer content (e.g. filling with {@code 0}) but just
+ * clears the two pointers. Please also note that the semantic of this
+ * operation is different from {@link ByteBuffer#clear()}.
+ *
+ * <pre>
+ * BEFORE clear()
+ *
+ * +-------------------+------------------+------------------+
+ * | discardable bytes | readable bytes | writable bytes |
+ * +-------------------+------------------+------------------+
+ * | | | |
+ * 0 <= readerIndex <= writerIndex <= capacity
+ *
+ *
+ * AFTER clear()
+ *
+ * +---------------------------------------------------------+
+ * | writable bytes (got more space) |
+ * +---------------------------------------------------------+
+ * | |
+ * 0 = readerIndex = writerIndex <= capacity
+ * </pre>
+ *
+ * <h3>Search operations</h3>
+ *
+ * Various {@code indexOf()} methods help you locate an index of a value which
+ * meets a certain criteria. Complicated dynamic sequential search can be done
+ * with {@link ChannelBufferIndexFinder} as well as simple static single byte
+ * search.
+ *
+ * <h3>Mark and reset</h3>
+ *
+ * There are two marker indexes in every buffer. One is for storing
+ * {@link #readerIndex() readerIndex} and the other is for storing
+ * {@link #writerIndex() writerIndex}. You can always reposition one of the
+ * two indexes by calling a reset method. It works in a similar fashion to
+ * the mark and reset methods in {@link InputStream} except that there's no
+ * {@code readlimit}.
+ *
+ * <h3>Derived buffers</h3>
+ *
+ * You can create a view of an existing buffer by calling either
+ * {@link #duplicate()}, {@link #slice()} or {@link #slice(int, int)}.
+ * A derived buffer will have an independent {@link #readerIndex() readerIndex},
+ * {@link #writerIndex() writerIndex} and marker indexes, while it shares
+ * other internal data representation, just like a NIO buffer does.
+ * <p>
+ * In case a completely fresh copy of an existing buffer is required, please
+ * call {@link #copy()} method instead.
+ *
+ * <h3>Conversion to existing JDK types</h3>
+ *
+ * <h4>NIO Buffers</h4>
+ *
+ * Various {@link #toByteBuffer()} and {@link #toByteBuffers()} methods convert
+ * a {@link ChannelBuffer} into one or more NIO buffers. These methods avoid
+ * buffer allocation and memory copy whenever possible, but there's no
+ * guarantee that memory copy will not be involved or that an explicit memory
+ * copy will be involved.
+ *
+ * <h4>Strings</h4>
+ *
+ * Various {@link #toString(String)} methods convert a {@link ChannelBuffer}
+ * into a {@link String}. Plesae note that {@link #toString()} is not a
+ * conversion method.
+ *
+ * <h4>I/O Streams</h4>
+ *
+ * Please refer to {@link ChannelBufferInputStream} and
+ * {@link ChannelBufferOutputStream}.
+ *
+ * @author The Netty Project (netty-dev at lists.jboss.org)
+ * @author Trustin Lee (tlee at redhat.com)
+ *
+ * @version $Rev: 472 $, $Date: 2008-11-14 16:45:53 +0900 (Fri, 14 Nov 2008) $
+ *
+ * @apiviz.landmark
+ */
+public interface ChannelBuffer extends Comparable<ChannelBuffer> {
+
+ /**
+ * Returns the number of bytes (octets) this buffer can contain.
+ */
+ int capacity();
+
+ /**
+ * Returns the {@code readerIndex} of this buffer.
+ */
+ int readerIndex();
+
+ /**
+ * Sets the {@code readerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code readerIndex} is
+ * less than {@code 0} or
+ * greater than {@code this.writerIndex}
+ */
+ void readerIndex(int readerIndex);
+
+ /**
+ * Returns the {@code writerIndex} of this buffer.
+ */
+ int writerIndex();
+
+ /**
+ * Sets the {@code writerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code writerIndex} is
+ * less than {@code this.readerIndex} or
+ * greater than {@code this.capacity}
+ */
+ void writerIndex(int writerIndex);
+
+ /**
+ * Sets the {@code readerIndex} and {@code writerIndex} of this buffer
+ * in one shot. This method is useful when you have to worry about the
+ * invocation order of {@link #readerIndex(int)} and {@link #writerIndex(int)}
+ * methods. For example, the following code will fail:
+ *
+ * <pre>
+ * // Create a buffer whose readerIndex, writerIndex and capacity are
+ * // 0, 0 and 8 respectively.
+ * ChannelBuffer buf = ChannelBuffers.buffer(8);
+ *
+ * // IndexOutOfBoundsException is thrown because the specified
+ * // readerIndex (2) cannot be greater than the current writerIndex (0).
+ * buf.readerIndex(2);
+ * buf.writerIndex(4);
+ * </pre>
+ *
+ * The following code will also fail:
+ *
+ * <pre>
+ * // Create a buffer whose readerIndex, writerIndex and capacity are
+ * // 0, 8 and 8 respectively.
+ * ChannelBuffer buf = ChannelBuffers.wrappedBuffer(new byte[8]);
+ *
+ * // readerIndex becomes 8.
+ * buf.readLong();
+ *
+ * // IndexOutOfBoundsException is thrown because the specified
+ * // writerIndex (4) cannot be less than the current readerIndex (8).
+ * buf.writerIndex(4);
+ * buf.readerIndex(2);
+ * </pre>
+ *
+ * By contrast, {@link #setIndex(int, int)} guarantees that it never
+ * throws an {@link IndexOutOfBoundsException} as long as the specified
+ * indexes meet basic constraints, regardless what the current index
+ * values of the buffer are:
+ *
+ * <pre>
+ * // No matter what the current state of the buffer is, the following
+ * // call always succeeds as long as the capacity of the buffer is not
+ * // less than 4.
+ * buf.setIndex(2, 4);
+ * </pre>
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code readerIndex} is less than 0,
+ * if the specified {@code writerIndex} is less than the specified
+ * {@code readerIndex} or if the specified {@code writerIndex} is
+ * greater than {@code this.capacity}
+ */
+ void setIndex(int readerIndex, int writerIndex);
+
+ /**
+ * Returns the number of readable bytes which is equal to
+ * {@code (this.writerIndex - this.readerIndex)}.
+ */
+ int readableBytes();
+
+ /**
+ * Returns the number of writable bytes which is equal to
+ * {@code (this.capacity - this.writerIndex)}.
+ */
+ int writableBytes();
+
+ /**
+ * Returns {@code true}
+ * if and only if {@code (this.writerIndex - this.readerIndex)} is greater
+ * than {@code 0}.
+ */
+ boolean readable();
+
+ /**
+ * Returns {@code true}
+ * if and only if {@code (this.capacity - this.writerIndex)} is greater
+ * than {@code 0}.
+ */
+ boolean writable();
+
+ /**
+ * Sets the {@code readerIndex} and {@code writerIndex} of this buffer to
+ * {@code 0}.
+ * This method is identical to {@link #setIndex(int, int) setIndex(0, 0)}.
+ * <p>
+ * Please note that the behavior of this method is different
+ * from that of NIO buffer, which sets the {@code limit} to
+ * the {@code capacity} of the buffer.
+ */
+ void clear();
+
+ /**
+ * Marks the current {@code readerIndex} in this buffer. You can
+ * reposition the current {@code readerIndex} to the marked
+ * {@code readerIndex} by calling {@link #resetReaderIndex()}.
+ * The initial value of the marked {@code readerIndex} is {@code 0}.
+ */
+ void markReaderIndex();
+
+ /**
+ * Repositions the current {@code readerIndex} to the marked
+ * {@code readerIndex} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the current {@code writerIndex} is less than the marked
+ * {@code readerIndex}
+ */
+ void resetReaderIndex();
+
+ /**
+ * Marks the current {@code writerIndex} in this buffer. You can
+ * reposition the current {@code writerIndex} to the marked
+ * {@code writerIndex} by calling {@link #resetWriterIndex()}.
+ * The initial value of the marked {@code writerIndex} is {@code 0}.
+ */
+ void markWriterIndex();
+
+ /**
+ * Repositions the current {@code writerIndex} to the marked
+ * {@code writerIndex} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the current {@code readerIndex} is greater than the marked
+ * {@code writerIndex}
+ */
+ void resetWriterIndex();
+
+ /**
+ * Discards the bytes between the 0th index and {@code readerIndex}.
+ * It moves the bytes between {@code readerIndex} and {@code writerIndex}
+ * to the 0th index, and sets {@code readerIndex} and {@code writerIndex}
+ * to {@code 0} and {@code oldWriterIndex - oldReaderIndex} respectively.
+ * <p>
+ * Please refer to the class documentation for more detailed explanation.
+ */
+ void discardReadBytes();
+
+ /**
+ * Gets a byte at the specified absolute {@code index} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 1} is greater than {@code this.capacity}
+ */
+ byte getByte(int index);
+
+ /**
+ * Gets an unsigned byte at the specified absolute {@code index} in this
+ * buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 1} is greater than {@code this.capacity}
+ */
+ short getUnsignedByte(int index);
+
+ /**
+ * Gets a 16-bit short integer at the specified absolute {@code index} in
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 2} is greater than {@code this.capacity}
+ */
+ short getShort(int index);
+
+ /**
+ * Gets an unsigned 16-bit short integer at the specified absolute
+ * {@code index} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 2} is greater than {@code this.capacity}
+ */
+ int getUnsignedShort(int index);
+
+ /**
+ * Gets a 24-bit medium integer at the specified absolute {@code index} in
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 3} is greater than {@code this.capacity}
+ */
+ int getMedium(int index);
+
+ /**
+ * Gets an unsigned 24-bit medium integer at the specified absolute
+ * {@code index} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 3} is greater than {@code this.capacity}
+ */
+ int getUnsignedMedium(int index);
+
+ /**
+ * Gets a 32-bit integer at the specified absolute {@code index} in
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 4} is greater than {@code this.capacity}
+ */
+ int getInt(int index);
+
+ /**
+ * Gets an unsigned 32-bit integer at the specified absolute {@code index}
+ * in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 4} is greater than {@code this.capacity}
+ */
+ long getUnsignedInt(int index);
+
+ /**
+ * Gets a 64-bit long integer at the specified absolute {@code index} in
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 8} is greater than {@code this.capacity}
+ */
+ long getLong(int index);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index} until the destination becomes
+ * non-writable. This method is basically same with
+ * {@link #getBytes(int, ChannelBuffer, int, int)}, except that this
+ * method increases the {@code writerIndex} of the destination by the
+ * number of the transferred bytes while
+ * {@link #getBytes(int, ChannelBuffer, int, int)} does not.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + dst.writableBytes} is greater than
+ * {@code this.capacity}
+ */
+ void getBytes(int index, ChannelBuffer dst);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index}. This method is basically same
+ * with {@link #getBytes(int, ChannelBuffer, int, int)}, except that this
+ * method increases the {@code writerIndex} of the destination by the
+ * number of the transferred bytes while
+ * {@link #getBytes(int, ChannelBuffer, int, int)} does not.
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code length} is greater than {@code dst.writableBytes}
+ */
+ void getBytes(int index, ChannelBuffer dst, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index}.
+ *
+ * @param dstIndex the first index of the destination
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if the specified {@code dstIndex} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code dstIndex + length} is greater than
+ * {@code dst.capacity}
+ */
+ void getBytes(int index, ChannelBuffer dst, int dstIndex, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index}.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + dst.length} is greater than
+ * {@code this.capacity}
+ */
+ void getBytes(int index, byte[] dst);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index}.
+ *
+ * @param dstIndex the first index of the destination
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if the specified {@code dstIndex} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code dstIndex + length} is greater than
+ * {@code dst.length}
+ */
+ void getBytes(int index, byte[] dst, int dstIndex, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index} until the destination's position
+ * reaches its limit.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + dst.remaining()} is greater than
+ * {@code this.capacity}
+ */
+ void getBytes(int index, ByteBuffer dst);
+
+ /**
+ * Transfers this buffer's data to the specified stream starting at the
+ * specified absolute {@code index}.
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + length} is greater than
+ * {@code this.capacity}
+ * @throws IOException
+ * if the specified stream threw an exception during I/O
+ */
+ void getBytes(int index, OutputStream out, int length) throws IOException;
+
+ /**
+ * Transfers this buffer's data to the specified channel starting at the
+ * specified absolute {@code index}.
+ *
+ * @param length the maximum number of bytes to transfer
+ *
+ * @return the actual number of bytes written out to the specified channel
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + length} is greater than
+ * {@code this.capacity}
+ * @throws IOException
+ * if the specified channel threw an exception during I/O
+ */
+ int getBytes(int index, GatheringByteChannel out, int length) throws IOException;
+
+ /**
+ * Sets the specified byte at the specified absolute {@code index} in this
+ * buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 1} is greater than {@code this.capacity}
+ */
+ void setByte(int index, byte value);
+
+ /**
+ * Sets the specified 16-bit short integer at the specified absolute
+ * {@code index} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 2} is greater than {@code this.capacity}
+ */
+ void setShort(int index, short value);
+
+ /**
+ * Sets the specified 24-bit medium integer at the specified absolute
+ * {@code index} in this buffer. Please note that the most significant
+ * byte is ignored in the specified value.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 3} is greater than {@code this.capacity}
+ */
+ void setMedium(int index, int value);
+
+ /**
+ * Sets the specified 32-bit integer at the specified absolute
+ * {@code index} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 4} is greater than {@code this.capacity}
+ */
+ void setInt(int index, int value);
+
+ /**
+ * Sets the specified 64-bit long integer at the specified absolute
+ * {@code index} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 8} is greater than {@code this.capacity}
+ */
+ void setLong(int index, long value);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the specified absolute {@code index} until the destination becomes
+ * unreadable. This method is basically same with
+ * {@link #setBytes(int, ChannelBuffer, int, int)}, except that this
+ * method increases the {@code readerIndex} of the source buffer by
+ * the number of the transferred bytes while
+ * {@link #getBytes(int, ChannelBuffer, int, int)} does not.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + src.readableBytes} is greater than
+ * {@code this.capacity}
+ */
+ void setBytes(int index, ChannelBuffer src);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the specified absolute {@code index}. This method is basically same
+ * with {@link #setBytes(int, ChannelBuffer, int, int)}, except that this
+ * method increases the {@code readerIndex} of the source buffer by
+ * the number of the transferred bytes while
+ * {@link #getBytes(int, ChannelBuffer, int, int)} does not.
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code length} is greater than {@code src.readableBytes}
+ */
+ void setBytes(int index, ChannelBuffer src, int length);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the specified absolute {@code index}.
+ *
+ * @param srcIndex the first index of the source
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if the specified {@code srcIndex} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code srcIndex + length} is greater than
+ * {@code src.capacity}
+ */
+ void setBytes(int index, ChannelBuffer src, int srcIndex, int length);
+
+ /**
+ * Transfers the specified source array's data to this buffer starting at
+ * the specified absolute {@code index}.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + src.length} is greater than
+ * {@code this.capacity}
+ */
+ void setBytes(int index, byte[] src);
+
+ /**
+ * Transfers the specified source array's data to this buffer starting at
+ * the specified absolute {@code index}.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if the specified {@code srcIndex} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code srcIndex + length} is greater than {@code src.length}
+ */
+ void setBytes(int index, byte[] src, int srcIndex, int length);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the specified absolute {@code index} until the source buffer's position
+ * reaches its limit.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + src.remaining()} is greater than
+ * {@code this.capacity}
+ */
+ void setBytes(int index, ByteBuffer src);
+
+ /**
+ * Transfers the content of the specified source stream to this buffer
+ * starting at the specified absolute {@code index}.
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @return the actual number of bytes read in from the specified channel.
+ * {@code -1} if the specified channel is closed.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + length} is greater than {@code this.capacity}
+ * @throws IOException
+ * if the specified stream threw an exception during I/O
+ */
+ int setBytes(int index, InputStream in, int length) throws IOException;
+
+ /**
+ * Transfers the content of the specified source channel to this buffer
+ * starting at the specified absolute {@code index}.
+ *
+ * @param length the maximum number of bytes to transfer
+ *
+ * @return the actual number of bytes read in from the specified channel.
+ * {@code -1} if the specified channel is closed.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + length} is greater than {@code this.capacity}
+ * @throws IOException
+ * if the specified channel threw an exception during I/O
+ */
+ int setBytes(int index, ScatteringByteChannel in, int length) throws IOException;
+
+ /**
+ * Fills this buffer with <tt>NUL (0x00)</tt> starting at the specified
+ * absolute {@code index}.
+ *
+ * @param length the number of <tt>NUL</tt>s to write to the buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + length} is greater than {@code this.capacity}
+ */
+ void setZero(int index, int length);
+
+ /**
+ * Gets a byte at the current {@code readerIndex} and increases
+ * the {@code readerIndex} by {@code 1} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 1}
+ */
+ byte readByte();
+
+ /**
+ * Gets an unsigned byte at the current {@code readerIndex} and increases
+ * the {@code readerIndex} by {@code 1} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 1}
+ */
+ short readUnsignedByte();
+
+ /**
+ * Gets a 16-bit short integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 2} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 2}
+ */
+ short readShort();
+
+ /**
+ * Gets an unsigned 16-bit short integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 2} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 2}
+ */
+ int readUnsignedShort();
+
+ /**
+ * Gets a 24-bit medium integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 3} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 3}
+ */
+ int readMedium();
+
+ /**
+ * Gets an unsigned 24-bit medium integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 3} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 3}
+ */
+ int readUnsignedMedium();
+
+ /**
+ * Gets a 32-bit integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 4} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 4}
+ */
+ int readInt();
+
+ /**
+ * Gets an unsigned 32-bit integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 4} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 4}
+ */
+ long readUnsignedInt();
+
+ /**
+ * Gets a 64-bit integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 8} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 8}
+ */
+ long readLong();
+
+ /**
+ * Transfers this buffer's data to a newly created buffer starting at
+ * the current {@code readerIndex} and increases the {@code readerIndex}
+ * by the number of the transferred bytes (= {@code length}).
+ * The returned buffer's {@code readerIndex} and {@code writerIndex} are
+ * {@code 0} and {@code length} respectively.
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @return the newly created buffer which contains the transferred bytes
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.readableBytes}
+ */
+ ChannelBuffer readBytes(int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} until the destination becomes
+ * non-writable, and increases the {@code readerIndex} by the number of the
+ * transferred bytes. This method is basically same with
+ * {@link #readBytes(ChannelBuffer, int, int)}, except that this method
+ * increases the {@code writerIndex} of the destination by the number of
+ * the transferred bytes while {@link #readBytes(ChannelBuffer, int, int)}
+ * does not.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code dst.writableBytes} is greater than
+ * {@code this.readableBytes}
+ */
+ void readBytes(ChannelBuffer dst);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} and increases the {@code readerIndex}
+ * by the number of the transferred bytes (= {@code length}). This method
+ * is basically same with {@link #readBytes(ChannelBuffer, int, int)},
+ * except that this method increases the {@code writerIndex} of the
+ * destination by the number of the transferred bytes (= {@code length})
+ * while {@link #readBytes(ChannelBuffer, int, int)} does not.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.readableBytes} or
+ * if {@code length} is greater than {@code dst.writableBytes}
+ */
+ void readBytes(ChannelBuffer dst, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} and increases the {@code readerIndex}
+ * by the number of the transferred bytes (= {@code length}).
+ *
+ * @param dstIndex the first index of the destination
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code dstIndex} is less than {@code 0},
+ * if {@code length} is greater than {@code this.readableBytes}, or
+ * if {@code dstIndex + length} is greater than
+ * {@code dst.capacity}
+ */
+ void readBytes(ChannelBuffer dst, int dstIndex, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} and increases the {@code readerIndex}
+ * by the number of the transferred bytes (= {@code dst.length}).
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code dst.length} is greater than {@code this.readableBytes}
+ */
+ void readBytes(byte[] dst);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} and increases the {@code readerIndex}
+ * by the number of the transferred bytes (= {@code length}).
+ *
+ * @param dstIndex the first index of the destination
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code dstIndex} is less than {@code 0},
+ * if {@code length} is greater than {@code this.readableBytes}, or
+ * if {@code dstIndex + length} is greater than {@code dst.length}
+ */
+ void readBytes(byte[] dst, int dstIndex, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} until the destination's position
+ * reaches its limit, and increases the {@code readerIndex} by the
+ * number of the transferred bytes.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code dst.remaining()} is greater than
+ * {@code this.readableBytes}
+ */
+ void readBytes(ByteBuffer dst);
+
+ /**
+ * Transfers this buffer's data to the specified stream starting at the
+ * current {@code readerIndex}.
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.readableBytes}
+ * @throws IOException
+ * if the specified stream threw an exception during I/O
+ */
+ void readBytes(OutputStream out, int length) throws IOException;
+
+ /**
+ * Transfers this buffer's data to the specified stream starting at the
+ * current {@code readerIndex}.
+ *
+ * @param length the maximum number of bytes to transfer
+ *
+ * @return the actual number of bytes written out to the specified channel
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.readableBytes}
+ * @throws IOException
+ * if the specified channel threw an exception during I/O
+ */
+ int readBytes(GatheringByteChannel out, int length) throws IOException;
+
+ /**
+ * Increases the current {@code readerIndex} by the specified
+ * {@code length} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.readableBytes}
+ */
+ void skipBytes(int length);
+
+ /**
+ * Sets the specified byte at the current {@code writerIndex}
+ * and increases the {@code writerIndex} by {@code 1} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 1}
+ */
+ void writeByte(byte value);
+
+ /**
+ * Sets the specified 16-bit short integer at the current
+ * {@code writerIndex} and increases the {@code writerIndex} by {@code 2}
+ * in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 2}
+ */
+ void writeShort(short value);
+
+ /**
+ * Sets the specified 24-bit medium integer at the current
+ * {@code writerIndex} and increases the {@code writerIndex} by {@code 3}
+ * in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 3}
+ */
+ void writeMedium(int value);
+
+ /**
+ * Sets the specified 32-bit integer at the current {@code writerIndex}
+ * and increases the {@code writerIndex} by {@code 4} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 4}
+ */
+ void writeInt(int value);
+
+ /**
+ * Sets the specified 64-bit long integer at the current
+ * {@code writerIndex} and increases the {@code writerIndex} by {@code 8}
+ * in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 8}
+ */
+ void writeLong(long value);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the current {@code writerIndex} until the source buffer becomes
+ * unreadable, and increases the {@code writerIndex} by the number of
+ * the transferred bytes. This method is basically same with
+ * {@link #writeBytes(ChannelBuffer, int, int)}, except that this method
+ * increases the {@code readerIndex} of the source buffer by the number of
+ * the transferred bytes while {@link #writeBytes(ChannelBuffer, int, int)}
+ * does not.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code src.readableBytes} is greater than
+ * {@code this.writableBytes}
+ *
+ */
+ void writeBytes(ChannelBuffer src);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the current {@code writerIndex} and increases the {@code writerIndex}
+ * by the number of the transferred bytes (= {@code length}). This method
+ * is basically same with {@link #writeBytes(ChannelBuffer, int, int)},
+ * except that this method increases the {@code readerIndex} of the source
+ * buffer by the number of the transferred bytes (= {@code length}) while
+ * {@link #writeBytes(ChannelBuffer, int, int)} does not.
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.writableBytes} or
+ * if {@code length} is greater then {@code src.readableBytes}
+ */
+ void writeBytes(ChannelBuffer src, int length);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the current {@code writerIndex} and increases the {@code writerIndex}
+ * by the number of the transferred bytes (= {@code length}).
+ *
+ * @param srcIndex the first index of the source
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code srcIndex} is less than {@code 0},
+ * if {@code srcIndex + length} is greater than
+ * {@code src.capacity}, or
+ * if {@code length} is greater than {@code this.writableBytes}
+ */
+ void writeBytes(ChannelBuffer src, int srcIndex, int length);
+
+ /**
+ * Transfers the specified source array's data to this buffer starting at
+ * the current {@code writerIndex} and increases the {@code writerIndex}
+ * by the number of the transferred bytes (= {@code src.length}).
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code src.length} is greater than {@code this.writableBytes}
+ */
+ void writeBytes(byte[] src);
+
+ /**
+ * Transfers the specified source array's data to this buffer starting at
+ * the current {@code writerIndex} and increases the {@code writerIndex}
+ * by the number of the transferred bytes (= {@code length}).
+ *
+ * @param srcIndex the first index of the source
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code srcIndex} is less than {@code 0},
+ * if {@code srcIndex + length} is greater than
+ * {@code src.length}, or
+ * if {@code length} is greater than {@code this.writableBytes}
+ */
+ void writeBytes(byte[] src, int srcIndex, int length);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the current {@code writerIndex} until the source buffer's position
+ * reaches its limit, and increases the {@code writerIndex} by the
+ * number of the transferred bytes.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code src.remaining()} is greater than
+ * {@code this.writableBytes}
+ */
+ void writeBytes(ByteBuffer src);
+
+ /**
+ * Transfers the content of the specified stream to this buffer
+ * starting at the current {@code writerIndex} and increases the
+ * {@code writerIndex} by the number of the transferred bytes.
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.writableBytes}
+ * @throws IOException
+ * if the specified stream threw an exception during I/O
+ */
+ void writeBytes(InputStream in, int length) throws IOException;
+
+ /**
+ * Transfers the content of the specified channel to this buffer
+ * starting at the current {@code writerIndex} and increases the
+ * {@code writerIndex} by the number of the transferred bytes.
+ *
+ * @param length the maximum number of bytes to transfer
+ *
+ * @return the actual number of bytes read in from the specified channel
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.writableBytes}
+ * @throws IOException
+ * if the specified channel threw an exception during I/O
+ */
+ int writeBytes(ScatteringByteChannel in, int length) throws IOException;
+
+ /**
+ * Fills this buffer with <tt>NUL (0x00)</tt> starting at the current
+ * {@code writerIndex} and increases the {@code writerIndex} by the
+ * specified {@code length}.
+ *
+ * @param length the number of <tt>NUL</tt>s to write to the buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.writableBytes}
+ */
+ void writeZero(int length);
+
+ /**
+ * Converts this buffer's readable bytes into a NIO buffer. The returned
+ * buffer might or might not share the content with this buffer, while
+ * they have separate indexes and marks. This method is identical to
+ * {@code buf.toByteBuffer(buf.readerIndex(), buf.readableBytes())}.
+ */
+ ByteBuffer toByteBuffer();
+
+ /**
+ * Converts this buffer's sub-region into a NIO buffer. The returned
+ * buffer might or might not share the content with this buffer, while
+ * they have separate indexes and marks.
+ */
+ ByteBuffer toByteBuffer(int index, int length);
+
+ /**
+ * Converts this buffer's sub-region into an array of NIO buffers.
+ * The returned buffers might or might not share the content with this
+ * buffer, while they have separate indexes and marks.
+ */
+ ByteBuffer[] toByteBuffers(int index, int length);
+
+ /**
+ * Decodes this buffer's readable bytes into a string with the specified
+ * character set name. This method is identical to
+ * {@code buf.toString(buf.readerIndex(), buf.readableBytes(), charsetName)}.
+ *
+ * @throws UnsupportedCharsetException
+ * if the specified character set name is not supported by the
+ * current VM
+ */
+ String toString(String charsetName);
+
+ /**
+ * Decodes this buffer's sub-region into a string with the specified
+ * character set name.
+ *
+ * @throws UnsupportedCharsetException
+ * if the specified character set name is not supported by the
+ * current VM
+ */
+ String toString(int index, int length, String charsetName);
+
+ /**
+ * Returns a hash code which was calculated from the content of this
+ * buffer. If there's a byte array which is
+ * {@linkplain #equals(Object) equal to} this array, both arrays should
+ * return the same value.
+ */
+ int hashCode();
+
+ /**
+ * Determines if the content of the specified buffer is identical to the
+ * content of this array. 'Identical' here means:
+ * <ul>
+ * <li>the size of the contents of the two buffers are same and</li>
+ * <li>every single byte of the content of the two buffers are same.</li>
+ * </ul>
+ * Please note that it does not compare {@link #readerIndex()} nor
+ * {@link #writerIndex()}. This method also returns {@code false} for
+ * {@code null} and an object which is not an instance of
+ * {@link ChannelBuffer} type.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Compares the content of the specified buffer to the content of this
+ * buffer. Comparison is performed in the same manner with the string
+ * comparison functions of various languages such as {@code strcmp},
+ * {@code memcmp} and {@link String#compareTo(String)}.
+ */
+ int compareTo(ChannelBuffer buffer);
+
+ /**
+ * Returns the string representation of this buffer. This method does not
+ * necessarily return the whole content of the buffer but returns
+ * the values of the key properties such as {@link #readerIndex()},
+ * {@link #writerIndex()} and {@link #capacity()}.
+ */
+ String toString();
+}
Added: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/ChannelBuffers.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/ChannelBuffers.java (rev 0)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/ChannelBuffers.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -0,0 +1,449 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.remoting.buffers;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Creates a new {@link ChannelBuffer} by allocating new space or by wrapping
+ * or copying existing byte arrays, byte buffers and a string.
+ *
+ * <h3>Use static import</h3>
+ * This classes is intended to be used with Java 5 static import statement:
+ *
+ * <pre>
+ * import static org.jboss.netty.buffer.ChannelBuffers.*;
+ *
+ * ChannelBuffer heapBuffer = buffer(128);
+ * ChannelBuffer directBuffer = directBuffer(256);
+ * ChannelBuffer dynamicBuffer = dynamicBuffer(512);
+ * ChannelBuffer wrappedBuffer = wrappedBuffer(new byte[128], new byte[256]);
+ * ChannelBuffer copiedBuffer = copiedBuffer(ByteBuffer.allocate(128));
+ * </pre>
+ *
+ * <h3>Allocating a new buffer</h3>
+ *
+ * Three buffer types are provided out of the box.
+ *
+ * <ul>
+ * <li>{@link #buffer(int)} allocates a new fixed-capacity heap buffer.</li>
+ * <li>{@link #directBuffer(int)} allocates a new fixed-capacity direct buffer.</li>
+ * <li>{@link #dynamicBuffer(int)} allocates a new dynamic-capacity heap
+ * buffer, whose capacity increases automatically as needed by a write
+ * operation.</li>
+ * </ul>
+ *
+ * <h3>Creating a wrapped buffer</h3>
+ *
+ * Wrapped buffer is a buffer which is a view of one or more existing
+ * byte arrays and byte buffers. Any changes in the content of the original
+ * array or buffer will be reflected in the wrapped buffer. Various wrapper
+ * methods are provided and their name is all {@code wrappedBuffer()}.
+ * You might want to take a look at this method closely if you want to create
+ * a buffer which is composed of more than one array to reduce the number of
+ * memory copy.
+ *
+ * <h3>Creating a copied buffer</h3>
+ *
+ * Copied buffer is a deep copy of one or more existing byte arrays, byte
+ * buffers or a string. Unlike a wrapped buffer, there's no shared data
+ * between the original data and the copied buffer. Various copy methods are
+ * provided and their name is all {@code copiedBuffer()}. It is also convenient
+ * to use this operation to merge multiple buffers into one buffer.
+ *
+ * <h3>Miscellaneous utility methods</h3>
+ *
+ * This class also provides various utility methods to help implementation
+ * of a new buffer type, generation of hex dump and swapping an integer's
+ * byte order.
+ *
+ * @author The Netty Project (netty-dev at lists.jboss.org)
+ * @author Trustin Lee (tlee at redhat.com)
+ *
+ * @version $Rev: 472 $, $Date: 2008-11-14 16:45:53 +0900 (Fri, 14 Nov 2008) $
+ *
+ * @apiviz.landmark
+ * @apiviz.has org.jboss.netty.buffer.ChannelBuffer oneway - - creates
+ */
+public class ChannelBuffers
+{
+
+ /**
+ * A buffer whose capacity is {@code 0}.
+ */
+ public static final ChannelBuffer EMPTY_BUFFER = new HeapChannelBuffer(0);
+
+ private static final char[] HEXDUMP_TABLE = new char[65536 * 4];
+
+ static
+ {
+ final char[] DIGITS = "0123456789abcdef".toCharArray();
+ for (int i = 0; i < 65536; i++)
+ {
+ HEXDUMP_TABLE[(i << 2) + 0] = DIGITS[i >>> 12 & 0x0F];
+ HEXDUMP_TABLE[(i << 2) + 1] = DIGITS[i >>> 8 & 0x0F];
+ HEXDUMP_TABLE[(i << 2) + 2] = DIGITS[i >>> 4 & 0x0F];
+ HEXDUMP_TABLE[(i << 2) + 3] = DIGITS[i >>> 0 & 0x0F];
+ }
+ }
+
+ /**
+ * Creates a new Java heap buffer with the specified {@code endianness}
+ * and {@code capacity}. The new buffer's {@code readerIndex} and
+ * {@code writerIndex} are {@code 0}.
+ */
+ public static ChannelBuffer buffer(int capacity)
+ {
+ if (capacity == 0)
+ {
+ return EMPTY_BUFFER;
+ }
+ else
+ {
+ return new HeapChannelBuffer(capacity);
+ }
+ }
+
+ /**
+ * Creates a new dynamic buffer with the specified endianness and
+ * the specified estimated data length. More accurate estimation yields
+ * less unexpected reallocation overhead. The new buffer's
+ * {@code readerIndex} and {@code writerIndex} are {@code 0}.
+ */
+ public static ChannelBuffer dynamicBuffer(int estimatedLength)
+ {
+ return new DynamicChannelBuffer(estimatedLength);
+ }
+
+ /**
+ * Creates a new buffer which wraps the specified {@code array} with the
+ * specified {@code endianness}. A modification on the specified array's
+ * content will be visible to the returned buffer.
+ */
+ public static ChannelBuffer wrappedBuffer(byte[] array)
+ {
+ return new HeapChannelBuffer(array);
+ }
+
+
+ /**
+ * Creates a new buffer with the specified {@code endianness} whose
+ * content is a copy of the specified {@code array}. The new buffer's
+ * {@code readerIndex} and {@code writerIndex} are {@code 0} and
+ * {@code array.length} respectively.
+ */
+ public static ChannelBuffer copiedBuffer(byte[] array)
+ {
+ if (array.length == 0)
+ {
+ return EMPTY_BUFFER;
+ }
+ else
+ {
+ return new HeapChannelBuffer(array.clone());
+ }
+ }
+
+ /**
+ * Creates a new buffer whose content is a copy of the specified
+ * {@code buffer}'s current slice. The new buffer's {@code readerIndex}
+ * and {@code writerIndex} are {@code 0} and {@code buffer.remaining}
+ * respectively.
+ */
+ public static ChannelBuffer copiedBuffer(ByteBuffer buffer)
+ {
+ int length = buffer.remaining();
+ if (length == 0)
+ {
+ return EMPTY_BUFFER;
+ }
+ byte[] copy = new byte[length];
+ int position = buffer.position();
+ try
+ {
+ buffer.get(copy);
+ }
+ finally
+ {
+ buffer.position(position);
+ }
+ return wrappedBuffer(copy);
+ }
+
+ /**
+ * Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a>
+ * of the specified buffer's readable bytes.
+ */
+ public static String hexDump(ChannelBuffer buffer)
+ {
+ return hexDump(buffer, buffer.readerIndex(), buffer.readableBytes());
+ }
+
+ /**
+ * Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a>
+ * of the specified buffer's sub-region.
+ */
+ public static String hexDump(ChannelBuffer buffer, int fromIndex, int length)
+ {
+ if (length < 0)
+ {
+ throw new IllegalArgumentException("length: " + length);
+ }
+ if (length == 0)
+ {
+ return "";
+ }
+
+ int endIndex = fromIndex + (length >>> 1 << 1);
+ boolean oddLength = length % 2 != 0;
+ char[] buf = new char[length << 1];
+
+ int srcIdx = fromIndex;
+ int dstIdx = 0;
+ for (; srcIdx < endIndex; srcIdx += 2, dstIdx += 4)
+ {
+ System.arraycopy(HEXDUMP_TABLE, buffer.getUnsignedShort(srcIdx) << 2, buf, dstIdx, 4);
+ }
+
+ if (oddLength)
+ {
+ System.arraycopy(HEXDUMP_TABLE, (buffer.getUnsignedByte(srcIdx) << 2) + 2, buf, dstIdx, 2);
+ }
+
+ return new String(buf);
+ }
+
+ /**
+ * Calculates the hash code of the specified buffer. This method is
+ * useful when implementing a new buffer type.
+ */
+ public static int hashCode(ChannelBuffer buffer)
+ {
+ final int aLen = buffer.readableBytes();
+ final int intCount = aLen >>> 2;
+ final int byteCount = aLen & 3;
+
+ int hashCode = 1;
+ int arrayIndex = buffer.readerIndex();
+ for (int i = intCount; i > 0; i--)
+ {
+ hashCode = 31 * hashCode + buffer.getInt(arrayIndex);
+ arrayIndex += 4;
+ }
+
+ for (int i = byteCount; i > 0; i--)
+ {
+ hashCode = 31 * hashCode + buffer.getByte(arrayIndex++);
+ }
+
+ if (hashCode == 0)
+ {
+ hashCode = 1;
+ }
+
+ return hashCode;
+ }
+
+ /**
+ * Returns {@code true} if and only if the two specified buffers are
+ * identical to each other as described in {@code ChannelBuffer#equals(Object)}.
+ * This method is useful when implementing a new buffer type.
+ */
+ public static boolean equals(ChannelBuffer bufferA, ChannelBuffer bufferB)
+ {
+ final int aLen = bufferA.readableBytes();
+ if (aLen != bufferB.readableBytes())
+ {
+ return false;
+ }
+
+ final int longCount = aLen >>> 3;
+ final int byteCount = aLen & 7;
+
+ int aIndex = bufferA.readerIndex();
+ int bIndex = bufferB.readerIndex();
+
+ for (int i = longCount; i > 0; i--)
+ {
+ if (bufferA.getLong(aIndex) != bufferB.getLong(bIndex))
+ {
+ return false;
+ }
+ aIndex += 8;
+ bIndex += 8;
+ }
+
+ for (int i = byteCount; i > 0; i--)
+ {
+ if (bufferA.getByte(aIndex) != bufferB.getByte(bIndex))
+ {
+ return false;
+ }
+ aIndex++;
+ bIndex++;
+ }
+
+ return true;
+ }
+
+ /**
+ * Compares the two specified buffers as described in {@link ChannelBuffer#compareTo(ChannelBuffer)}.
+ * This method is useful when implementing a new buffer type.
+ */
+ public static int compare(ChannelBuffer bufferA, ChannelBuffer bufferB)
+ {
+ final int aLen = bufferA.readableBytes();
+ final int bLen = bufferB.readableBytes();
+ final int minLength = Math.min(aLen, bLen);
+ final int uintCount = minLength >>> 2;
+ final int byteCount = minLength & 3;
+
+ int aIndex = bufferA.readerIndex();
+ int bIndex = bufferB.readerIndex();
+
+ for (int i = uintCount; i > 0; i--)
+ {
+ long va = bufferA.getUnsignedInt(aIndex);
+ long vb = bufferB.getUnsignedInt(bIndex);
+ if (va > vb)
+ {
+ return 1;
+ }
+ else if (va < vb)
+ {
+ return -1;
+ }
+ aIndex += 4;
+ bIndex += 4;
+ }
+
+ for (int i = byteCount; i > 0; i--)
+ {
+ byte va = bufferA.getByte(aIndex);
+ byte vb = bufferB.getByte(bIndex);
+ if (va > vb)
+ {
+ return 1;
+ }
+ else if (va < vb)
+ {
+ return -1;
+ }
+ aIndex++;
+ bIndex++;
+ }
+
+ return aLen - bLen;
+ }
+
+ /**
+ * The default implementation of {@link ChannelBuffer#indexOf(int, int, byte)}.
+ * This method is useful when implementing a new buffer type.
+ */
+ public static int indexOf(ChannelBuffer buffer, int fromIndex, int toIndex, byte value)
+ {
+ if (fromIndex <= toIndex)
+ {
+ return firstIndexOf(buffer, fromIndex, toIndex, value);
+ }
+ else
+ {
+ return lastIndexOf(buffer, fromIndex, toIndex, value);
+ }
+ }
+
+ /**
+ * Toggles the endianness of the specified 16-bit short integer.
+ */
+ public static short swapShort(short value)
+ {
+ return (short)(value << 8 | value >>> 8 & 0xff);
+ }
+
+ /**
+ * Toggles the endianness of the specified 24-bit medium integer.
+ */
+ public static int swapMedium(int value)
+ {
+ return value << 16 & 0xff0000 | value & 0xff00 | value >>> 16 & 0xff;
+ }
+
+ /**
+ * Toggles the endianness of the specified 32-bit integer.
+ */
+ public static int swapInt(int value)
+ {
+ return swapShort((short)value) << 16 | swapShort((short)(value >>> 16)) & 0xffff;
+ }
+
+ /**
+ * Toggles the endianness of the specified 64-bit long integer.
+ */
+ public static long swapLong(long value)
+ {
+ return (long)swapInt((int)value) << 32 | swapInt((int)(value >>> 32)) & 0xffffffffL;
+ }
+
+ private static int firstIndexOf(ChannelBuffer buffer, int fromIndex, int toIndex, byte value)
+ {
+ fromIndex = Math.max(fromIndex, 0);
+ if (fromIndex >= toIndex || buffer.capacity() == 0)
+ {
+ return -1;
+ }
+
+ for (int i = fromIndex; i < toIndex; i++)
+ {
+ if (buffer.getByte(i) == value)
+ {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ private static int lastIndexOf(ChannelBuffer buffer, int fromIndex, int toIndex, byte value)
+ {
+ fromIndex = Math.min(fromIndex, buffer.capacity());
+ if (fromIndex < 0 || buffer.capacity() == 0)
+ {
+ return -1;
+ }
+
+ for (int i = fromIndex - 1; i >= toIndex; i--)
+ {
+ if (buffer.getByte(i) == value)
+ {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ private ChannelBuffers()
+ {
+ // Unused
+ }
+}
Added: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/DynamicChannelBuffer.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/DynamicChannelBuffer.java (rev 0)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/DynamicChannelBuffer.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -0,0 +1,267 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.remoting.buffers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.GatheringByteChannel;
+import java.nio.channels.ScatteringByteChannel;
+
+/**
+ * A dynamic capacity buffer which increases its capacity as needed. It is
+ * recommended to use {@link ChannelBuffers#dynamicBuffer(int)} instead of
+ * calling the constructor explicitly.
+ *
+ * @author The Netty Project (netty-dev at lists.jboss.org)
+ * @author Trustin Lee (tlee at redhat.com)
+ *
+ * @version $Rev: 237 $, $Date: 2008-09-04 20:53:44 +0900 (Thu, 04 Sep 2008) $
+ *
+ */
+public class DynamicChannelBuffer extends AbstractChannelBuffer
+{
+
+ private final int initialCapacity;
+
+ private ChannelBuffer buffer = ChannelBuffers.EMPTY_BUFFER;
+
+ public DynamicChannelBuffer(int estimatedLength)
+ {
+ if (estimatedLength < 0)
+ {
+ throw new IllegalArgumentException("estimatedLength: " + estimatedLength);
+ }
+ initialCapacity = estimatedLength;
+ }
+
+ public int capacity()
+ {
+ return buffer.capacity();
+ }
+
+ public byte getByte(int index)
+ {
+ return buffer.getByte(index);
+ }
+
+ public short getShort(int index)
+ {
+ return buffer.getShort(index);
+ }
+
+ public int getUnsignedMedium(int index)
+ {
+ return buffer.getUnsignedMedium(index);
+ }
+
+ public int getInt(int index)
+ {
+ return buffer.getInt(index);
+ }
+
+ public long getLong(int index)
+ {
+ return buffer.getLong(index);
+ }
+
+ public void getBytes(int index, byte[] dst, int dstIndex, int length)
+ {
+ buffer.getBytes(index, dst, dstIndex, length);
+ }
+
+ public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length)
+ {
+ buffer.getBytes(index, dst, dstIndex, length);
+ }
+
+ public void getBytes(int index, ByteBuffer dst)
+ {
+ buffer.getBytes(index, dst);
+ }
+
+ public int getBytes(int index, GatheringByteChannel out, int length) throws IOException
+ {
+ return buffer.getBytes(index, out, length);
+ }
+
+ public void getBytes(int index, OutputStream out, int length) throws IOException
+ {
+ buffer.getBytes(index, out, length);
+ }
+
+ public void setByte(int index, byte value)
+ {
+ buffer.setByte(index, value);
+ }
+
+ public void setShort(int index, short value)
+ {
+ buffer.setShort(index, value);
+ }
+
+ public void setMedium(int index, int value)
+ {
+ buffer.setMedium(index, value);
+ }
+
+ public void setInt(int index, int value)
+ {
+ buffer.setInt(index, value);
+ }
+
+ public void setLong(int index, long value)
+ {
+ buffer.setLong(index, value);
+ }
+
+ public void setBytes(int index, byte[] src, int srcIndex, int length)
+ {
+ buffer.setBytes(index, src, srcIndex, length);
+ }
+
+ public void setBytes(int index, ChannelBuffer src, int srcIndex, int length)
+ {
+ buffer.setBytes(index, src, srcIndex, length);
+ }
+
+ public void setBytes(int index, ByteBuffer src)
+ {
+ buffer.setBytes(index, src);
+ }
+
+ public int setBytes(int index, InputStream in, int length) throws IOException
+ {
+ return buffer.setBytes(index, in, length);
+ }
+
+ public int setBytes(int index, ScatteringByteChannel in, int length) throws IOException
+ {
+ return buffer.setBytes(index, in, length);
+ }
+
+ @Override
+ public void writeByte(byte value)
+ {
+ ensureWritableBytes(1);
+ super.writeByte(value);
+ }
+
+ @Override
+ public void writeShort(short value)
+ {
+ ensureWritableBytes(2);
+ super.writeShort(value);
+ }
+
+ @Override
+ public void writeMedium(int value)
+ {
+ ensureWritableBytes(3);
+ super.writeMedium(value);
+ }
+
+ @Override
+ public void writeInt(int value)
+ {
+ ensureWritableBytes(4);
+ super.writeInt(value);
+ }
+
+ @Override
+ public void writeLong(long value)
+ {
+ ensureWritableBytes(8);
+ super.writeLong(value);
+ }
+
+ @Override
+ public void writeBytes(byte[] src, int srcIndex, int length)
+ {
+ ensureWritableBytes(length);
+ super.writeBytes(src, srcIndex, length);
+ }
+
+ @Override
+ public void writeBytes(ChannelBuffer src, int srcIndex, int length)
+ {
+ ensureWritableBytes(length);
+ super.writeBytes(src, srcIndex, length);
+ }
+
+ @Override
+ public void writeBytes(ByteBuffer src)
+ {
+ ensureWritableBytes(src.remaining());
+ super.writeBytes(src);
+ }
+
+ @Override
+ public void writeZero(int length)
+ {
+ ensureWritableBytes(length);
+ super.writeZero(length);
+ }
+
+ public ByteBuffer toByteBuffer(int index, int length)
+ {
+ return buffer.toByteBuffer(index, length);
+ }
+
+ public String toString(int index, int length, String charsetName)
+ {
+ return buffer.toString(index, length, charsetName);
+ }
+
+ private void ensureWritableBytes(int requestedBytes)
+ {
+ if (requestedBytes <= writableBytes())
+ {
+ return;
+ }
+
+ int newCapacity;
+ if (capacity() == 0)
+ {
+ newCapacity = initialCapacity;
+ if (newCapacity == 0)
+ {
+ newCapacity = 1;
+ }
+ }
+ else
+ {
+ newCapacity = capacity();
+ }
+ int minNewCapacity = writerIndex() + requestedBytes;
+ while (newCapacity < minNewCapacity)
+ {
+ newCapacity <<= 1;
+ }
+
+ ChannelBuffer newBuffer = ChannelBuffers.buffer(newCapacity);
+ newBuffer.writeBytes(buffer, readerIndex(), readableBytes());
+ buffer = newBuffer;
+ }
+}
Added: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/HeapChannelBuffer.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/HeapChannelBuffer.java (rev 0)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/buffers/HeapChannelBuffer.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -0,0 +1,271 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.messaging.core.remoting.buffers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.GatheringByteChannel;
+import java.nio.channels.ScatteringByteChannel;
+import java.nio.charset.UnsupportedCharsetException;
+
+/**
+ * A skeletal implementation for Java heap buffers.
+ *
+ * @author The Netty Project (netty-dev at lists.jboss.org)
+ * @author Trustin Lee (tlee at redhat.com)
+ *
+ * @version $Rev: 486 $, $Date: 2008-11-16 22:52:47 +0900 (Sun, 16 Nov 2008) $
+ */
+public class HeapChannelBuffer extends AbstractChannelBuffer {
+
+ /**
+ * The underlying heap byte array that this buffer is wrapping.
+ */
+ protected final byte[] array;
+
+ /**
+ * Creates a new heap buffer with a newly allocated byte array.
+ *
+ * @param length the length of the new byte array
+ */
+ public HeapChannelBuffer(int length) {
+ this(new byte[length], 0, 0);
+ }
+
+ /**
+ * Creates a new heap buffer with an existing byte array.
+ *
+ * @param array the byte array to wrap
+ */
+ public HeapChannelBuffer(byte[] array) {
+ this(array, 0, array.length);
+ }
+
+ /**
+ * Creates a new heap buffer with an existing byte array.
+ *
+ * @param array the byte array to wrap
+ * @param readerIndex the initial reader index of this buffer
+ * @param writerIndex the initial writer index of this buffer
+ */
+ protected HeapChannelBuffer(byte[] array, int readerIndex, int writerIndex) {
+ if (array == null) {
+ throw new NullPointerException("array");
+ }
+ this.array = array;
+ setIndex(readerIndex, writerIndex);
+ }
+
+ public int capacity() {
+ return array.length;
+ }
+
+ public byte getByte(int index) {
+ return array[index];
+ }
+
+ public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) {
+ if (dst instanceof HeapChannelBuffer) {
+ getBytes(index, ((HeapChannelBuffer) dst).array, dstIndex, length);
+ } else {
+ dst.setBytes(dstIndex, array, index, length);
+ }
+ }
+
+ public void getBytes(int index, byte[] dst, int dstIndex, int length) {
+ System.arraycopy(array, index, dst, dstIndex, length);
+ }
+
+ public void getBytes(int index, ByteBuffer dst) {
+ dst.put(array, index, Math.min(capacity() - index, dst.remaining()));
+ }
+
+ public void getBytes(int index, OutputStream out, int length)
+ throws IOException {
+ out.write(array, index, length);
+ }
+
+ public int getBytes(int index, GatheringByteChannel out, int length)
+ throws IOException {
+ return out.write(ByteBuffer.wrap(array, index, length));
+ }
+
+ public void setByte(int index, byte value) {
+ array[index] = value;
+ }
+
+ public void setBytes(int index, ChannelBuffer src, int srcIndex, int length) {
+ if (src instanceof HeapChannelBuffer) {
+ setBytes(index, ((HeapChannelBuffer) src).array, srcIndex, length);
+ } else {
+ src.getBytes(srcIndex, array, index, length);
+ }
+ }
+
+ public void setBytes(int index, byte[] src, int srcIndex, int length) {
+ System.arraycopy(src, srcIndex, array, index, length);
+ }
+
+ public void setBytes(int index, ByteBuffer src) {
+ src.get(array, index, src.remaining());
+ }
+
+ public int setBytes(int index, InputStream in, int length) throws IOException {
+ int readBytes = 0;
+ do {
+ int localReadBytes = in.read(array, index, length);
+ if (localReadBytes < 0) {
+ if (readBytes == 0) {
+ return -1;
+ } else {
+ break;
+ }
+ }
+ readBytes += localReadBytes;
+ index += localReadBytes;
+ length -= localReadBytes;
+ } while (length > 0);
+
+ return readBytes;
+ }
+
+ public int setBytes(int index, ScatteringByteChannel in, int length) throws IOException {
+ ByteBuffer buf = ByteBuffer.wrap(array, index, length);
+ int readBytes = 0;
+
+ do {
+ int localReadBytes;
+ try {
+ localReadBytes = in.read(buf);
+ } catch (ClosedChannelException e) {
+ localReadBytes = -1;
+ }
+ if (localReadBytes < 0) {
+ if (readBytes == 0) {
+ return -1;
+ } else {
+ break;
+ }
+ } else if (localReadBytes == 0) {
+ break;
+ }
+ readBytes += localReadBytes;
+ } while (readBytes < length);
+
+ return readBytes;
+ }
+
+ public short getShort(final int index)
+ {
+ return (short)(array[index] << 8 | array[index + 1] & 0xFF);
+ }
+
+ public int getUnsignedMedium(final int index)
+ {
+ return (array[index] & 0xff) << 16 | (array[index + 1] & 0xff) << 8 | (array[index + 2] & 0xff) << 0;
+ }
+
+ public int getInt(final int index)
+ {
+ return (array[index] & 0xff) << 24 | (array[index + 1] & 0xff) << 16 |
+ (array[index + 2] & 0xff) << 8 |
+ (array[index + 3] & 0xff) << 0;
+ }
+
+ public long getLong(final int index)
+ {
+ return ((long)array[index] & 0xff) << 56 | ((long)array[index + 1] & 0xff) << 48 |
+ ((long)array[index + 2] & 0xff) << 40 |
+ ((long)array[index + 3] & 0xff) << 32 |
+ ((long)array[index + 4] & 0xff) << 24 |
+ ((long)array[index + 5] & 0xff) << 16 |
+ ((long)array[index + 6] & 0xff) << 8 |
+ ((long)array[index + 7] & 0xff) << 0;
+ }
+
+ public void setShort(final int index, final short value)
+ {
+ array[index] = (byte)(value >>> 8);
+ array[index + 1] = (byte)(value >>> 0);
+ }
+
+ public void setMedium(final int index, final int value)
+ {
+ array[index] = (byte)(value >>> 16);
+ array[index + 1] = (byte)(value >>> 8);
+ array[index + 2] = (byte)(value >>> 0);
+ }
+
+ public void setInt(final int index, final int value)
+ {
+ array[index] = (byte)(value >>> 24);
+ array[index + 1] = (byte)(value >>> 16);
+ array[index + 2] = (byte)(value >>> 8);
+ array[index + 3] = (byte)(value >>> 0);
+ }
+
+ public void setLong(final int index, final long value)
+ {
+ array[index] = (byte)(value >>> 56);
+ array[index + 1] = (byte)(value >>> 48);
+ array[index + 2] = (byte)(value >>> 40);
+ array[index + 3] = (byte)(value >>> 32);
+ array[index + 4] = (byte)(value >>> 24);
+ array[index + 5] = (byte)(value >>> 16);
+ array[index + 6] = (byte)(value >>> 8);
+ array[index + 7] = (byte)(value >>> 0);
+ }
+
+ public ChannelBuffer copy(final int index, final int length)
+ {
+ if (index < 0 || length < 0 || index + length > array.length)
+ {
+ throw new IndexOutOfBoundsException();
+ }
+
+ byte[] copiedArray = new byte[length];
+ System.arraycopy(array, index, copiedArray, 0, length);
+ return new HeapChannelBuffer(copiedArray);
+ }
+
+ public ChannelBuffer duplicate() {
+ return new HeapChannelBuffer(array, readerIndex(), writerIndex());
+ }
+
+ public ByteBuffer toByteBuffer(int index, int length) {
+ return ByteBuffer.wrap(array, index, length);
+ }
+
+ public String toString(int index, int length, String charsetName) {
+ try {
+ return new String(array, index, length, charsetName);
+ } catch (UnsupportedEncodingException e) {
+ throw new UnsupportedCharsetException(charsetName);
+ }
+ }
+}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/AbstractBufferHandler.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/AbstractBufferHandler.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/AbstractBufferHandler.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -41,7 +41,7 @@
return -1;
}
- int length = buffer.getInt();
+ int length = buffer.readInt();
if (buffer.remaining() < length)
{
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -108,53 +108,53 @@
buffer.rewind();
}
- public boolean getBoolean()
+ public boolean readBoolean()
{
byte b = buffer.get();
return (b == TRUE);
}
- public byte getByte()
+ public byte readByte()
{
return buffer.get();
}
- public short getUnsignedByte()
+ public short readUnsignedByte()
{
return (short)(buffer.get() & 0xFF);
}
- public void getBytes(byte[] bytes)
+ public void readBytes(byte[] bytes)
{
buffer.get(bytes);
}
- public void getBytes(byte[] bytes, int offset, int length)
+ public void readBytes(byte[] bytes, int offset, int length)
{
buffer.get(bytes, offset, length);
}
- public double getDouble()
+ public double readDouble()
{
return buffer.getDouble();
}
- public float getFloat()
+ public float readFloat()
{
return buffer.getFloat();
}
- public int getInt()
+ public int readInt()
{
return buffer.getInt();
}
- public long getLong()
+ public long readLong()
{
return buffer.getLong();
}
- public void putNullableString(final String nullableString)
+ public void writeNullableString(final String nullableString)
{
if (nullableString == null)
{
@@ -164,11 +164,11 @@
{
buffer.put(NOT_NULL);
- putString(nullableString);
+ writeString(nullableString);
}
}
- public String getNullableString()
+ public String readNullableString()
{
byte check = buffer.get();
@@ -178,11 +178,11 @@
}
else
{
- return getString();
+ return readString();
}
}
- public void putString(final String nullableString)
+ public void writeString(final String nullableString)
{
//We don't encode
@@ -194,27 +194,27 @@
}
}
- public void putUTF(final String str) throws Exception
+ public void writeUTF(final String str) throws Exception
{
UTF8Util.saveUTF(this, str);
}
- public short getShort()
+ public short readShort()
{
return buffer.getShort();
}
- public int getUnsignedShort()
+ public int readUnsignedShort()
{
return buffer.getShort() & 0xFFFF;
}
- public char getChar()
+ public char readChar()
{
return buffer.getChar();
}
- public String getString()
+ public String readString()
{
int len = buffer.getInt();
@@ -228,7 +228,7 @@
return new String(chars);
}
- public void putSimpleString(final SimpleString string)
+ public void writeSimpleString(final SimpleString string)
{
byte[] data = string.getData();
@@ -236,7 +236,7 @@
buffer.put(data);
}
- public SimpleString getNullableSimpleString()
+ public SimpleString readNullableSimpleString()
{
int b = buffer.get();
if (b == NULL)
@@ -245,11 +245,11 @@
}
else
{
- return getSimpleString();
+ return readSimpleString();
}
}
- public void putNullableSimpleString(final SimpleString string)
+ public void writeNullableSimpleString(final SimpleString string)
{
if (string == null)
{
@@ -258,11 +258,11 @@
else
{
buffer.put(NOT_NULL);
- putSimpleString(string);
+ writeSimpleString(string);
}
}
- public SimpleString getSimpleString()
+ public SimpleString readSimpleString()
{
int len = buffer.getInt();
@@ -272,7 +272,7 @@
return new SimpleString(data);
}
- public String getUTF() throws Exception
+ public String readUTF() throws Exception
{
return UTF8Util.readUTF(this);
}
@@ -287,7 +287,7 @@
buffer.limit(limit);
}
- public void putBoolean(boolean val)
+ public void writeBoolean(boolean val)
{
if (val)
{
@@ -299,52 +299,52 @@
}
}
- public void putByte(byte val)
+ public void writeByte(byte val)
{
buffer.put(val);
}
- public void putBytes(byte[] bytes)
+ public void writeBytes(byte[] bytes)
{
buffer.put(bytes);
}
- public void putBytes(byte[] bytes, int offset, int len)
+ public void writeBytes(byte[] bytes, int offset, int len)
{
buffer.put(bytes, offset, len);
}
- public void putDouble(double val)
+ public void writeDouble(double val)
{
buffer.putDouble(val);
}
- public void putFloat(float val)
+ public void writeFloat(float val)
{
buffer.putFloat(val);
}
- public void putInt(int val)
+ public void writeInt(int val)
{
buffer.putInt(val);
}
- public void putInt(int pos, int val)
+ public void setInt(int pos, int val)
{
buffer.putInt(pos, val);
}
- public void putLong(long val)
+ public void writeLong(long val)
{
buffer.putLong(val);
}
- public void putShort(short val)
+ public void writeShort(short val)
{
buffer.putShort(val);
}
- public void putChar(char chr)
+ public void writeChar(char chr)
{
buffer.putChar(chr);
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -59,7 +59,7 @@
else
{
byte[] b = new byte[remaining()];
- getBytes(b);
+ readBytes(b);
return b;
}
}
@@ -79,112 +79,112 @@
buf.flip();
}
- public boolean getBoolean()
+ public boolean readBoolean()
{
- return getByte() != 0;
+ return readByte() != 0;
}
- public byte getByte()
+ public byte readByte()
{
return buf.get();
}
- public void getBytes(byte[] bytes)
+ public void readBytes(byte[] bytes)
{
buf.get(bytes);
}
- public void getBytes(byte[] bytes, int offset, int length)
+ public void readBytes(byte[] bytes, int offset, int length)
{
buf.get(bytes, offset, length);
}
- public char getChar()
+ public char readChar()
{
return buf.getChar();
}
- public double getDouble()
+ public double readDouble()
{
return buf.getDouble();
}
- public float getFloat()
+ public float readFloat()
{
return buf.getFloat();
}
- public int getInt()
+ public int readInt()
{
return buf.getInt();
}
- public long getLong()
+ public long readLong()
{
return buf.getLong();
}
- public SimpleString getNullableSimpleString()
+ public SimpleString readNullableSimpleString()
{
- if (getByte() == NULL)
+ if (readByte() == NULL)
{
return null;
}
else
{
- return getSimpleString();
+ return readSimpleString();
}
}
- public String getNullableString()
+ public String readNullableString()
{
- if (getByte() == NULL)
+ if (readByte() == NULL)
{
return null;
}
else
{
- return getString();
+ return readString();
}
}
- public short getShort()
+ public short readShort()
{
return buf.getShort();
}
- public SimpleString getSimpleString()
+ public SimpleString readSimpleString()
{
- int len = getInt();
+ int len = readInt();
byte[] data = new byte[len];
- getBytes(data);
+ readBytes(data);
return new SimpleString(data);
}
- public String getString()
+ public String readString()
{
- int len = getInt();
+ int len = readInt();
char[] chars = new char[len];
for (int i = 0; i < len; i++)
{
- chars[i] = getChar();
+ chars[i] = readChar();
}
return new String(chars);
}
- public String getUTF() throws Exception
+ public String readUTF() throws Exception
{
return UTF8Util.readUTF(this);
}
- public short getUnsignedByte()
+ public short readUnsignedByte()
{
- return (short) (getByte() & 0xFF);
+ return (short) (readByte() & 0xFF);
}
- public int getUnsignedShort()
+ public int readUnsignedShort()
{
- return getShort() & 0xFFFF;
+ return readShort() & 0xFFFF;
}
public int limit()
@@ -207,57 +207,57 @@
return buf.position();
}
- public void putBoolean(boolean val)
+ public void writeBoolean(boolean val)
{
- putByte((byte) (val ? -1 : 0));
+ writeByte((byte) (val ? -1 : 0));
}
- public void putByte(byte val)
+ public void writeByte(byte val)
{
ensureRemaining(1).put(val);
}
- public void putBytes(byte[] bytes)
+ public void writeBytes(byte[] bytes)
{
ensureRemaining(bytes.length).put(bytes);
}
- public void putBytes(byte[] bytes, int offset, int length)
+ public void writeBytes(byte[] bytes, int offset, int length)
{
ensureRemaining(length).put(bytes, offset, length);
}
- public void putChar(char val)
+ public void writeChar(char val)
{
ensureRemaining(2).putChar(val);
}
- public void putDouble(double val)
+ public void writeDouble(double val)
{
ensureRemaining(8).putDouble(val);
}
- public void putFloat(float val)
+ public void writeFloat(float val)
{
ensureRemaining(4).putFloat(val);
}
- public void putInt(int val)
+ public void writeInt(int val)
{
ensureRemaining(4).putInt(val);
}
- public void putInt(int pos, int val)
+ public void setInt(int pos, int val)
{
buf.putInt(pos, val);
}
- public void putLong(long val)
+ public void writeLong(long val)
{
ensureRemaining(8).putLong(val);
}
- public void putNullableSimpleString(SimpleString val)
+ public void writeNullableSimpleString(SimpleString val)
{
if (val == null)
{
@@ -274,7 +274,7 @@
}
}
- public void putNullableString(String val)
+ public void writeNullableString(String val)
{
if (val == null)
{
@@ -292,12 +292,12 @@
}
}
- public void putShort(short val)
+ public void writeShort(short val)
{
ensureRemaining(2).putShort(val);
}
- public void putSimpleString(SimpleString val)
+ public void writeSimpleString(SimpleString val)
{
byte[] data = val.getData();
ensureRemaining(4 + data.length);
@@ -305,7 +305,7 @@
buf.put(data);
}
- public void putString(String val)
+ public void writeString(String val)
{
ensureRemaining(4 + (val.length() << 1));
buf.putInt(val.length());
@@ -315,7 +315,7 @@
}
}
- public void putUTF(String utf) throws Exception
+ public void writeUTF(String utf) throws Exception
{
UTF8Util.saveUTF(this, utf);
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -615,7 +615,7 @@
private Packet decode(final MessagingBuffer in)
{
- final byte packetType = in.getByte();
+ final byte packetType = in.readByte();
Packet packet;
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnection.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -119,7 +119,7 @@
{
if (!closed)
{
- buffer.getInt(); // read and discard
+ buffer.readInt(); // read and discard
handler.bufferReceived(id, buffer);
}
else
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -152,32 +152,32 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putString(name);
- buffer.putLong(sessionChannelID);
- buffer.putInt(version);
- buffer.putNullableString(username);
- buffer.putNullableString(password);
- buffer.putInt(minLargeMessageSize);
- buffer.putBoolean(xa);
- buffer.putBoolean(autoCommitSends);
- buffer.putBoolean(autoCommitAcks);
- buffer.putInt(windowSize);
- buffer.putBoolean(preAcknowledge);
+ 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);
}
public void decodeBody(final MessagingBuffer buffer)
{
- name = buffer.getString();
- sessionChannelID = buffer.getLong();
- version = buffer.getInt();
- username = buffer.getNullableString();
- password = buffer.getNullableString();
- minLargeMessageSize = buffer.getInt();
- xa = buffer.getBoolean();
- autoCommitSends = buffer.getBoolean();
- autoCommitAcks = buffer.getBoolean();
- windowSize = buffer.getInt();
- preAcknowledge = buffer.getBoolean();
+ name = buffer.readString();
+ sessionChannelID = buffer.readLong();
+ version = buffer.readInt();
+ username = buffer.readNullableString();
+ password = buffer.readNullableString();
+ minLargeMessageSize = buffer.readInt();
+ xa = buffer.readBoolean();
+ autoCommitSends = buffer.readBoolean();
+ autoCommitAcks = buffer.readBoolean();
+ windowSize = buffer.readInt();
+ preAcknowledge = buffer.readBoolean();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionResponseMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionResponseMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionResponseMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -68,12 +68,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putInt(serverVersion);
+ buffer.writeInt(serverVersion);
}
public void decodeBody(final MessagingBuffer buffer)
{
- serverVersion = buffer.getInt();
+ serverVersion = buffer.readInt();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/MessagingExceptionMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/MessagingExceptionMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/MessagingExceptionMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -70,14 +70,14 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putInt(exception.getCode());
- buffer.putNullableString(exception.getMessage());
+ buffer.writeInt(exception.getCode());
+ buffer.writeNullableString(exception.getMessage());
}
public void decodeBody(final MessagingBuffer buffer)
{
- int code = buffer.getInt();
- String msg = buffer.getNullableString();
+ int code = buffer.readInt();
+ String msg = buffer.readNullableString();
exception = new MessagingException(code, msg);
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -177,9 +177,9 @@
public int encode(final MessagingBuffer buffer)
{
// The standard header fields
- buffer.putInt(0); // The length gets filled in at the end
- buffer.putByte(type);
- buffer.putLong(channelID);
+ buffer.writeInt(0); // The length gets filled in at the end
+ buffer.writeByte(type);
+ buffer.writeLong(channelID);
encodeBody(buffer);
@@ -188,7 +188,7 @@
// The length doesn't include the actual length byte
int len = size - DataConstants.SIZE_INT;
- buffer.putInt(0, len);
+ buffer.setInt(0, len);
buffer.flip();
@@ -197,7 +197,7 @@
public void decode(final MessagingBuffer buffer)
{
- channelID = buffer.getLong();
+ channelID = buffer.readLong();
decodeBody(buffer);
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketsConfirmedMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketsConfirmedMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketsConfirmedMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -64,12 +64,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putInt(commandID);
+ buffer.writeInt(commandID);
}
public void decodeBody(final MessagingBuffer buffer)
{
- commandID = buffer.getInt();
+ commandID = buffer.readInt();
}
@Override
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Ping.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Ping.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Ping.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -64,12 +64,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putLong(expirePeriod);
+ buffer.writeLong(expirePeriod);
}
public void decodeBody(final MessagingBuffer buffer)
{
- expirePeriod = buffer.getLong();
+ expirePeriod = buffer.readLong();
}
@Override
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Pong.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Pong.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Pong.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -70,12 +70,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putLong(newPeriod);
+ buffer.writeLong(newPeriod);
}
public void decodeBody(final MessagingBuffer buffer)
{
- newPeriod = buffer.getLong();
+ newPeriod = buffer.readLong();
}
public boolean isWriteAlways()
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -73,14 +73,14 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putString(name);
- buffer.putInt(lastReceivedCommandID);
+ buffer.writeString(name);
+ buffer.writeInt(lastReceivedCommandID);
}
public void decodeBody(final MessagingBuffer buffer)
{
- name = buffer.getString();
- lastReceivedCommandID = buffer.getInt();
+ name = buffer.readString();
+ lastReceivedCommandID = buffer.readInt();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionResponseMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionResponseMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionResponseMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -74,14 +74,14 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putInt(lastReceivedCommandID);
- buffer.putBoolean(removed);
+ buffer.writeInt(lastReceivedCommandID);
+ buffer.writeBoolean(removed);
}
public void decodeBody(final MessagingBuffer buffer)
{
- lastReceivedCommandID = buffer.getInt();
- removed = buffer.getBoolean();
+ lastReceivedCommandID = buffer.readInt();
+ removed = buffer.readBoolean();
}
public boolean isResponse()
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReplicateCreateSessionMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReplicateCreateSessionMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReplicateCreateSessionMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -163,32 +163,32 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putString(name);
- buffer.putLong(sessionChannelID);
- buffer.putInt(version);
- buffer.putNullableString(username);
- buffer.putNullableString(password);
- buffer.putInt(minLargeMessageSize);
- buffer.putBoolean(xa);
- buffer.putBoolean(autoCommitSends);
- buffer.putBoolean(autoCommitAcks);
- buffer.putInt(windowSize);
- buffer.putBoolean(preAcknowledge);
+ 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);
}
public void decodeBody(final MessagingBuffer buffer)
{
- name = buffer.getString();
- sessionChannelID = buffer.getLong();
- version = buffer.getInt();
- username = buffer.getNullableString();
- password = buffer.getNullableString();
- minLargeMessageSize = buffer.getInt();
- xa = buffer.getBoolean();
- autoCommitSends = buffer.getBoolean();
- autoCommitAcks = buffer.getBoolean();
- windowSize = buffer.getInt();
- preAcknowledge = buffer.getBoolean();
+ name = buffer.readString();
+ sessionChannelID = buffer.readLong();
+ version = buffer.readInt();
+ username = buffer.readNullableString();
+ password = buffer.readNullableString();
+ minLargeMessageSize = buffer.readInt();
+ xa = buffer.readBoolean();
+ autoCommitSends = buffer.readBoolean();
+ autoCommitAcks = buffer.readBoolean();
+ windowSize = buffer.readInt();
+ preAcknowledge = buffer.readBoolean();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -86,13 +86,13 @@
@Override
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putBoolean(considerLastMessageAsDelivered);
+ buffer.writeBoolean(considerLastMessageAsDelivered);
}
@Override
public void decodeBody(final MessagingBuffer buffer)
{
- this.considerLastMessageAsDelivered = buffer.getBoolean();
+ this.considerLastMessageAsDelivered = buffer.readBoolean();
}
// Static --------------------------------------------------------
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAcknowledgeMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAcknowledgeMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAcknowledgeMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -69,20 +69,20 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putLong(consumerID);
+ buffer.writeLong(consumerID);
- buffer.putLong(messageID);
+ buffer.writeLong(messageID);
- buffer.putBoolean(requiresResponse);
+ buffer.writeBoolean(requiresResponse);
}
public void decodeBody(final MessagingBuffer buffer)
{
- consumerID = buffer.getLong();
+ consumerID = buffer.readLong();
- messageID = buffer.getLong();
+ messageID = buffer.readLong();
- requiresResponse = buffer.getBoolean();
+ requiresResponse = buffer.readBoolean();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAddDestinationMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAddDestinationMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAddDestinationMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -84,16 +84,16 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putSimpleString(address);
- buffer.putBoolean(durable);
- buffer.putBoolean(temporary);
+ buffer.writeSimpleString(address);
+ buffer.writeBoolean(durable);
+ buffer.writeBoolean(temporary);
}
public void decodeBody(final MessagingBuffer buffer)
{
- address = buffer.getSimpleString();
- durable = buffer.getBoolean();
- temporary = buffer.getBoolean();
+ address = buffer.readSimpleString();
+ durable = buffer.readBoolean();
+ temporary = buffer.readBoolean();
}
@Override
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -56,12 +56,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putSimpleString(address);
+ buffer.writeSimpleString(address);
}
public void decodeBody(final MessagingBuffer buffer)
{
- address = buffer.getSimpleString();
+ address = buffer.readSimpleString();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -72,22 +72,22 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putBoolean(exists);
- buffer.putInt(queueNames.size());
+ buffer.writeBoolean(exists);
+ buffer.writeInt(queueNames.size());
for (SimpleString queueName: queueNames)
{
- buffer.putSimpleString(queueName);
+ buffer.writeSimpleString(queueName);
}
}
public void decodeBody(final MessagingBuffer buffer)
{
- exists = buffer.getBoolean();
- int numQueues = buffer.getInt();
+ exists = buffer.readBoolean();
+ int numQueues = buffer.readInt();
queueNames = new ArrayList<SimpleString>(numQueues);
for (int i = 0; i < numQueues; i++)
{
- queueNames.add(buffer.getSimpleString());
+ queueNames.add(buffer.readSimpleString());
}
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerCloseMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerCloseMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerCloseMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -62,12 +62,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putLong(consumerID);
+ buffer.writeLong(consumerID);
}
public void decodeBody(final MessagingBuffer buffer)
{
- consumerID = buffer.getLong();
+ consumerID = buffer.readLong();
}
@Override
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -72,14 +72,14 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putLong(consumerID);
- buffer.putInt(credits);
+ buffer.writeLong(consumerID);
+ buffer.writeInt(credits);
}
public void decodeBody(final MessagingBuffer buffer)
{
- consumerID = buffer.getLong();
- credits = buffer.getInt();
+ consumerID = buffer.readLong();
+ credits = buffer.readInt();
}
@Override
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionContinuationMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionContinuationMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionContinuationMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -91,18 +91,18 @@
@Override
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putInt(body.length);
- buffer.putBytes(body);
- buffer.putBoolean(continues);
+ buffer.writeInt(body.length);
+ buffer.writeBytes(body);
+ buffer.writeBoolean(continues);
}
@Override
public void decodeBody(final MessagingBuffer buffer)
{
- int size = buffer.getInt();
+ int size = buffer.readInt();
body = new byte[size];
- buffer.getBytes(body);
- continues = buffer.getBoolean();
+ buffer.readBytes(body);
+ continues = buffer.readBoolean();
}
// Package protected ---------------------------------------------
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -92,16 +92,16 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putSimpleString(queueName);
- buffer.putNullableSimpleString(filterString);
- buffer.putBoolean(browseOnly);
+ buffer.writeSimpleString(queueName);
+ buffer.writeNullableSimpleString(filterString);
+ buffer.writeBoolean(browseOnly);
}
public void decodeBody(final MessagingBuffer buffer)
{
- queueName = buffer.getSimpleString();
- filterString = buffer.getNullableSimpleString();
- browseOnly = buffer.getBoolean();
+ queueName = buffer.readSimpleString();
+ filterString = buffer.readNullableSimpleString();
+ browseOnly = buffer.readBoolean();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateQueueMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateQueueMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateQueueMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -105,20 +105,20 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putSimpleString(address);
- buffer.putSimpleString(queueName);
- buffer.putNullableSimpleString(filterString);
- buffer.putBoolean(durable);
- buffer.putBoolean(temporary);
+ buffer.writeSimpleString(address);
+ buffer.writeSimpleString(queueName);
+ buffer.writeNullableSimpleString(filterString);
+ buffer.writeBoolean(durable);
+ buffer.writeBoolean(temporary);
}
public void decodeBody(final MessagingBuffer buffer)
{
- address = buffer.getSimpleString();
- queueName = buffer.getSimpleString();
- filterString = buffer.getNullableSimpleString();
- durable = buffer.getBoolean();
- temporary = buffer.getBoolean();
+ address = buffer.readSimpleString();
+ queueName = buffer.readSimpleString();
+ filterString = buffer.readNullableSimpleString();
+ durable = buffer.readBoolean();
+ temporary = buffer.readBoolean();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -72,12 +72,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putSimpleString(queueName);
+ buffer.writeSimpleString(queueName);
}
public void decodeBody(final MessagingBuffer buffer)
{
- queueName = buffer.getSimpleString();
+ queueName = buffer.readSimpleString();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionExpiredMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionExpiredMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionExpiredMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -60,16 +60,16 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putLong(consumerID);
+ buffer.writeLong(consumerID);
- buffer.putLong(messageID);
+ buffer.writeLong(messageID);
}
public void decodeBody(final MessagingBuffer buffer)
{
- consumerID = buffer.getLong();
+ consumerID = buffer.readLong();
- messageID = buffer.getLong();
+ messageID = buffer.readLong();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionFailoverCompleteMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionFailoverCompleteMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionFailoverCompleteMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -64,12 +64,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putString(name);
+ buffer.writeString(name);
}
public void decodeBody(final MessagingBuffer buffer)
{
- name = buffer.getString();
+ name = buffer.readString();
}
public boolean isRequiresConfirmations()
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -56,12 +56,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putSimpleString(queueName);
+ buffer.writeSimpleString(queueName);
}
public void decodeBody(final MessagingBuffer buffer)
{
- queueName = buffer.getSimpleString();
+ queueName = buffer.readSimpleString();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -119,22 +119,22 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putBoolean(exists);
- buffer.putBoolean(durable);
- buffer.putInt(consumerCount);
- buffer.putInt(messageCount);
- buffer.putNullableSimpleString(filterString);
- buffer.putNullableSimpleString(address);
+ buffer.writeBoolean(exists);
+ buffer.writeBoolean(durable);
+ buffer.writeInt(consumerCount);
+ buffer.writeInt(messageCount);
+ buffer.writeNullableSimpleString(filterString);
+ buffer.writeNullableSimpleString(address);
}
public void decodeBody(final MessagingBuffer buffer)
{
- exists = buffer.getBoolean();
- durable = buffer.getBoolean();
- consumerCount = buffer.getInt();
- messageCount = buffer.getInt();
- filterString = buffer.getNullableSimpleString();
- address = buffer.getNullableSimpleString();
+ exists = buffer.readBoolean();
+ durable = buffer.readBoolean();
+ consumerCount = buffer.readInt();
+ messageCount = buffer.readInt();
+ filterString = buffer.readNullableSimpleString();
+ address = buffer.readNullableSimpleString();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveContinuationMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveContinuationMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveContinuationMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -92,14 +92,14 @@
public void encodeBody(final MessagingBuffer buffer)
{
super.encodeBody(buffer);
- buffer.putLong(consumerID);
+ buffer.writeLong(consumerID);
}
@Override
public void decodeBody(final MessagingBuffer buffer)
{
super.decodeBody(buffer);
- consumerID = buffer.getLong();
+ consumerID = buffer.readLong();
}
// Package protected ---------------------------------------------
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReceiveMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -149,13 +149,13 @@
}
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putLong(consumerID);
- buffer.putInt(deliveryCount);
- buffer.putBoolean(largeMessage);
+ buffer.writeLong(consumerID);
+ buffer.writeInt(deliveryCount);
+ buffer.writeBoolean(largeMessage);
if (largeMessage)
{
- buffer.putInt(largeMessageHeader.length);
- buffer.putBytes(largeMessageHeader);
+ buffer.writeInt(largeMessageHeader.length);
+ buffer.writeBytes(largeMessageHeader);
}
else
{
@@ -167,17 +167,17 @@
{
// TODO can be optimised
- consumerID = buffer.getLong();
+ consumerID = buffer.readLong();
- deliveryCount = buffer.getInt();
+ deliveryCount = buffer.readInt();
- largeMessage = buffer.getBoolean();
+ largeMessage = buffer.readBoolean();
if (largeMessage)
{
- int size = buffer.getInt();
+ int size = buffer.readInt();
largeMessageHeader = new byte[size];
- buffer.getBytes(largeMessageHeader);
+ buffer.readBytes(largeMessageHeader);
}
else
{
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionRemoveDestinationMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionRemoveDestinationMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionRemoveDestinationMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -75,14 +75,14 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putSimpleString(address);
- buffer.putBoolean(durable);
+ buffer.writeSimpleString(address);
+ buffer.writeBoolean(durable);
}
public void decodeBody(final MessagingBuffer buffer)
{
- address = buffer.getSimpleString();
- durable = buffer.getBoolean();
+ address = buffer.readSimpleString();
+ durable = buffer.readBoolean();
}
@Override
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReplicateDeliveryMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReplicateDeliveryMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionReplicateDeliveryMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -60,16 +60,16 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putLong(consumerID);
+ buffer.writeLong(consumerID);
- buffer.putLong(messageID);
+ buffer.writeLong(messageID);
}
public void decodeBody(final MessagingBuffer buffer)
{
- consumerID = buffer.getLong();
+ consumerID = buffer.readLong();
- messageID = buffer.getLong();
+ messageID = buffer.readLong();
}
public boolean isRequiresConfirmations()
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendContinuationMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -91,14 +91,14 @@
public void encodeBody(final MessagingBuffer buffer)
{
super.encodeBody(buffer);
- buffer.putBoolean(requiresResponse);
+ buffer.writeBoolean(requiresResponse);
}
@Override
public void decodeBody(final MessagingBuffer buffer)
{
super.decodeBody(buffer);
- requiresResponse = buffer.getBoolean();
+ requiresResponse = buffer.readBoolean();
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -147,21 +147,21 @@
@Override
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putBoolean(largeMessage);
+ buffer.writeBoolean(largeMessage);
if (largeMessage)
{
- buffer.putInt(largeMessageHeader.length);
- buffer.putBytes(largeMessageHeader);
+ buffer.writeInt(largeMessageHeader.length);
+ buffer.writeBytes(largeMessageHeader);
if (largeMessageId > 0)
{
- buffer.putBoolean(true);
- buffer.putLong(largeMessageId);
+ buffer.writeBoolean(true);
+ buffer.writeLong(largeMessageId);
}
else
{
- buffer.putBoolean(false);
+ buffer.writeBoolean(false);
}
}
else if (clientMessage != null)
@@ -174,27 +174,27 @@
serverMessage.encode(buffer);
}
- buffer.putBoolean(requiresResponse);
+ buffer.writeBoolean(requiresResponse);
}
@Override
public void decodeBody(final MessagingBuffer buffer)
{
- largeMessage = buffer.getBoolean();
+ largeMessage = buffer.readBoolean();
if (largeMessage)
{
- int largeMessageLength = buffer.getInt();
+ int largeMessageLength = buffer.readInt();
largeMessageHeader = new byte[largeMessageLength];
- buffer.getBytes(largeMessageHeader);
+ buffer.readBytes(largeMessageHeader);
- final boolean largeMessageIDFilled = buffer.getBoolean();
+ final boolean largeMessageIDFilled = buffer.readBoolean();
if (largeMessageIDFilled)
{
- this.largeMessageId = buffer.getLong();
+ this.largeMessageId = buffer.readLong();
}
else
{
@@ -213,7 +213,7 @@
serverMessage.getBody().flip();
- requiresResponse = buffer.getBoolean();
+ requiresResponse = buffer.readBoolean();
}
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXACommitMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXACommitMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXACommitMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -74,13 +74,13 @@
public void encodeBody(final MessagingBuffer buffer)
{
XidCodecSupport.encodeXid(xid, buffer);
- buffer.putBoolean(onePhase);
+ buffer.writeBoolean(onePhase);
}
public void decodeBody(final MessagingBuffer buffer)
{
xid = XidCodecSupport.decodeXid(buffer);
- onePhase = buffer.getBoolean();
+ onePhase = buffer.readBoolean();
}
@Override
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAEndMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAEndMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAEndMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -75,13 +75,13 @@
public void encodeBody(final MessagingBuffer buffer)
{
XidCodecSupport.encodeXid(xid, buffer);
- buffer.putBoolean(failed);
+ buffer.writeBoolean(failed);
}
public void decodeBody(final MessagingBuffer buffer)
{
xid = XidCodecSupport.decodeXid(buffer);
- failed = buffer.getBoolean();
+ failed = buffer.readBoolean();
}
@Override
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -73,7 +73,7 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putInt(xids.size());
+ buffer.writeInt(xids.size());
for (Xid xid: xids)
{
@@ -83,7 +83,7 @@
public void decodeBody(final MessagingBuffer buffer)
{
- int len = buffer.getInt();
+ int len = buffer.readInt();
xids = new ArrayList<Xid>(len);
for (int i = 0; i < len; i++)
{
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -69,12 +69,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putInt(timeoutSeconds);
+ buffer.writeInt(timeoutSeconds);
}
public void decodeBody(final MessagingBuffer buffer)
{
- timeoutSeconds = buffer.getInt();
+ timeoutSeconds = buffer.readInt();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResponseMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResponseMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResponseMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -86,16 +86,16 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putBoolean(error);
- buffer.putInt(responseCode);
- buffer.putNullableString(message);
+ buffer.writeBoolean(error);
+ buffer.writeInt(responseCode);
+ buffer.writeNullableString(message);
}
public void decodeBody(final MessagingBuffer buffer)
{
- error = buffer.getBoolean();
- responseCode = buffer.getInt();
- message = buffer.getNullableString();
+ error = buffer.readBoolean();
+ responseCode = buffer.readInt();
+ message = buffer.readNullableString();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -64,12 +64,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putInt(timeoutSeconds);
+ buffer.writeInt(timeoutSeconds);
}
public void decodeBody(final MessagingBuffer buffer)
{
- timeoutSeconds = buffer.getInt();
+ timeoutSeconds = buffer.readInt();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -68,12 +68,12 @@
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.putBoolean(ok);
+ buffer.writeBoolean(ok);
}
public void decodeBody(final MessagingBuffer buffer)
{
- ok = buffer.getBoolean();
+ ok = buffer.readBoolean();
}
public boolean equals(Object other)
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/XidCodecSupport.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/XidCodecSupport.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/impl/wireformat/XidCodecSupport.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -45,20 +45,20 @@
public static void encodeXid(final Xid xid, final MessagingBuffer out)
{
- out.putInt(xid.getFormatId());
- out.putInt(xid.getBranchQualifier().length);
- out.putBytes(xid.getBranchQualifier());
- out.putInt(xid.getGlobalTransactionId().length);
- out.putBytes(xid.getGlobalTransactionId());
+ out.writeInt(xid.getFormatId());
+ out.writeInt(xid.getBranchQualifier().length);
+ out.writeBytes(xid.getBranchQualifier());
+ out.writeInt(xid.getGlobalTransactionId().length);
+ out.writeBytes(xid.getGlobalTransactionId());
}
public static Xid decodeXid(final MessagingBuffer in)
{
- int formatID = in.getInt();
- byte[] bq = new byte[in.getInt()];
- in.getBytes(bq);
- byte[] gtxid = new byte[in.getInt()];
- in.getBytes(gtxid);
+ int formatID = in.readInt();
+ byte[] bq = new byte[in.readInt()];
+ in.readBytes(bq);
+ byte[] gtxid = new byte[in.readInt()];
+ in.readBytes(gtxid);
Xid xid = new XidImpl(bq, formatID, gtxid);
return xid;
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -33,93 +33,106 @@
*/
public interface MessagingBuffer
{
- void putByte(byte val);
+ void writeByte(byte val);
- void putBytes(byte[] bytes);
+ void writeBytes(byte[] bytes);
- void putBytes(byte[] bytes, int offset, int length);
+ void writeBytes(byte[] bytes, int offset, int length);
- void putInt(int val);
+ void writeInt(int val);
- void putInt(int pos, int val);
+ void setInt(int pos, int val);
- void putLong(long val);
+ void writeLong(long val);
- void putShort(short val);
+ void writeShort(short val);
- void putDouble(double val);
+ void writeDouble(double val);
- void putFloat(float val);
+ void writeFloat(float val);
- void putBoolean(boolean val);
+ void writeBoolean(boolean val);
- void putChar(char val);
+ void writeChar(char val);
- void putNullableString(String val);
+ void writeNullableString(String val);
- void putString(String val);
+ void writeString(String val);
- void putSimpleString(SimpleString val);
+ void writeSimpleString(SimpleString val);
- void putNullableSimpleString(SimpleString val);
+ void writeNullableSimpleString(SimpleString val);
- void putUTF(String utf) throws Exception;
+ void writeUTF(String utf) throws Exception;
- byte getByte();
+ byte readByte();
- short getUnsignedByte();
+ short readUnsignedByte();
- void getBytes(byte[] bytes);
+ void readBytes(byte[] bytes);
- void getBytes(byte[] bytes, int offset, int length);
+ void readBytes(byte[] bytes, int offset, int length);
- int getInt();
+ int readInt();
- long getLong();
+ long readLong();
- short getShort();
+ short readShort();
- int getUnsignedShort();
+ int readUnsignedShort();
- double getDouble();
+ double readDouble();
- float getFloat();
+ float readFloat();
- boolean getBoolean();
+ boolean readBoolean();
- char getChar();
+ char readChar();
- String getString();
+ String readString();
- String getNullableString();
+ String readNullableString();
- SimpleString getSimpleString();
+ SimpleString readSimpleString();
- SimpleString getNullableSimpleString();
+ SimpleString readNullableSimpleString();
- String getUTF() throws Exception;
+ String readUTF() throws Exception;
byte[] array();
- int remaining();
-
int capacity();
- int limit();
+ int readerIndex();
- void limit(int limit);
+ void readerIndex(int readerIndex);
- void flip();
+ int writerIndex();
- void position(int position);
+ void writerIndex(int writerIndex);
- int position();
+ void setIndex(int readerIndex, int writerIndex);
- void rewind();
+ int readableBytes();
- MessagingBuffer slice();
+ int writableBytes();
- MessagingBuffer createNewBuffer(int len);
+ boolean readable();
+ boolean writable();
+
+ void clear();
+
+ void markReaderIndex();
+
+ void resetReaderIndex();
+
+ void markWriterIndex();
+
+ void resetWriterIndex();
+
+ void discardReadBytes();
+
+
Object getUnderlyingBuffer();
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/integration/transports/mina/IoBufferWrapper.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -126,112 +126,112 @@
buffer.rewind();
}
- public void putByte(byte byteValue)
+ public void writeByte(byte byteValue)
{
buffer.put(byteValue);
}
- public void putBytes(final byte[] byteArray)
+ public void writeBytes(final byte[] byteArray)
{
buffer.put(byteArray);
}
- public void putBytes(final byte[] bytes, int offset, int length)
+ public void writeBytes(final byte[] bytes, int offset, int length)
{
buffer.put(bytes, offset, length);
}
- public void putInt(final int intValue)
+ public void writeInt(final int intValue)
{
buffer.putInt(intValue);
}
- public void putInt(final int pos, final int intValue)
+ public void setInt(final int pos, final int intValue)
{
buffer.putInt(pos, intValue);
}
- public void putLong(final long longValue)
+ public void writeLong(final long longValue)
{
buffer.putLong(longValue);
}
- public void putFloat(final float floatValue)
+ public void writeFloat(final float floatValue)
{
buffer.putFloat(floatValue);
}
- public void putDouble(final double d)
+ public void writeDouble(final double d)
{
buffer.putDouble(d);
}
- public void putShort(final short s)
+ public void writeShort(final short s)
{
buffer.putShort(s);
}
- public void putChar(final char chr)
+ public void writeChar(final char chr)
{
buffer.putChar(chr);
}
- public byte getByte()
+ public byte readByte()
{
return buffer.get();
}
- public short getUnsignedByte()
+ public short readUnsignedByte()
{
return buffer.getUnsigned();
}
- public void getBytes(final byte[] b)
+ public void readBytes(final byte[] b)
{
buffer.get(b);
}
- public void getBytes(final byte[] b, final int offset, final int length)
+ public void readBytes(final byte[] b, final int offset, final int length)
{
buffer.get(b, offset, length);
}
- public int getInt()
+ public int readInt()
{
return buffer.getInt();
}
- public long getLong()
+ public long readLong()
{
return buffer.getLong();
}
- public float getFloat()
+ public float readFloat()
{
return buffer.getFloat();
}
- public short getShort()
+ public short readShort()
{
return buffer.getShort();
}
- public int getUnsignedShort()
+ public int readUnsignedShort()
{
return buffer.getUnsignedShort();
}
- public double getDouble()
+ public double readDouble()
{
return buffer.getDouble();
}
- public char getChar()
+ public char readChar()
{
return buffer.getChar();
}
- public void putBoolean(final boolean b)
+ public void writeBoolean(final boolean b)
{
if (b)
{
@@ -242,13 +242,13 @@
}
}
- public boolean getBoolean()
+ public boolean readBoolean()
{
byte b = buffer.get();
return b == TRUE;
}
- public void putString(final String nullableString)
+ public void writeString(final String nullableString)
{
buffer.putInt(nullableString.length());
@@ -258,7 +258,7 @@
}
}
- public void putNullableString(final String nullableString)
+ public void writeNullableString(final String nullableString)
{
if (nullableString == null)
{
@@ -268,11 +268,11 @@
{
buffer.put(NOT_NULL);
- putString(nullableString);
+ writeString(nullableString);
}
}
- public String getString()
+ public String readString()
{
int len = buffer.getInt();
@@ -286,7 +286,7 @@
return new String(chars);
}
- public String getNullableString()
+ public String readNullableString()
{
byte check = buffer.get();
@@ -296,16 +296,16 @@
}
else
{
- return getString();
+ return readString();
}
}
- public void putUTF(final String str) throws Exception
+ public void writeUTF(final String str) throws Exception
{
buffer.putPrefixedString(str, utf8.newEncoder());
}
- public void putNullableSimpleString(final SimpleString string)
+ public void writeNullableSimpleString(final SimpleString string)
{
if (string == null)
{
@@ -314,11 +314,11 @@
else
{
buffer.put(NOT_NULL);
- putSimpleString(string);
+ writeSimpleString(string);
}
}
- public void putSimpleString(final SimpleString string)
+ public void writeSimpleString(final SimpleString string)
{
byte[] data = string.getData();
@@ -326,7 +326,7 @@
buffer.put(data);
}
- public SimpleString getSimpleString()
+ public SimpleString readSimpleString()
{
int len = buffer.getInt();
@@ -336,7 +336,7 @@
return new SimpleString(data);
}
- public SimpleString getNullableSimpleString()
+ public SimpleString readNullableSimpleString()
{
int b = buffer.get();
if (b == NULL)
@@ -345,11 +345,11 @@
}
else
{
- return getSimpleString();
+ return readSimpleString();
}
}
- public String getUTF() throws Exception
+ public String readUTF() throws Exception
{
return buffer.getPrefixedString(utf8.newDecoder());
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/integration/transports/netty/ChannelBufferWrapper.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -134,69 +134,69 @@
buffer.markReaderIndex();
}
- public void putByte(byte byteValue)
+ public void writeByte(byte byteValue)
{
flip();
buffer.writeByte(byteValue);
buffer.readerIndex(buffer.writerIndex());
}
- public void putBytes(final byte[] byteArray)
+ public void writeBytes(final byte[] byteArray)
{
flip();
buffer.writeBytes(byteArray);
buffer.readerIndex(buffer.writerIndex());
}
- public void putBytes(final byte[] bytes, int offset, int length)
+ public void writeBytes(final byte[] bytes, int offset, int length)
{
flip();
buffer.writeBytes(bytes, offset, length);
buffer.readerIndex(buffer.writerIndex());
}
- public void putInt(final int intValue)
+ public void writeInt(final int intValue)
{
flip();
buffer.writeInt(intValue);
buffer.readerIndex(buffer.writerIndex());
}
- public void putInt(final int pos, final int intValue)
+ public void setInt(final int pos, final int intValue)
{
buffer.setInt(pos, intValue);
}
- public void putLong(final long longValue)
+ public void writeLong(final long longValue)
{
flip();
buffer.writeLong(longValue);
buffer.readerIndex(buffer.writerIndex());
}
- public void putFloat(final float floatValue)
+ public void writeFloat(final float floatValue)
{
- putInt(Float.floatToIntBits(floatValue));
+ writeInt(Float.floatToIntBits(floatValue));
}
- public void putDouble(final double d)
+ public void writeDouble(final double d)
{
- putLong(Double.doubleToLongBits(d));
+ writeLong(Double.doubleToLongBits(d));
}
- public void putShort(final short s)
+ public void writeShort(final short s)
{
flip();
buffer.writeShort(s);
buffer.readerIndex(buffer.writerIndex());
}
- public void putChar(final char chr)
+ public void writeChar(final char chr)
{
- putShort((short)chr);
+ writeShort((short)chr);
}
- public byte getByte()
+ public byte readByte()
{
try
{
@@ -208,7 +208,7 @@
}
}
- public short getUnsignedByte()
+ public short readUnsignedByte()
{
try
{
@@ -220,7 +220,7 @@
}
}
- public void getBytes(final byte[] b)
+ public void readBytes(final byte[] b)
{
try
{
@@ -232,7 +232,7 @@
}
}
- public void getBytes(final byte[] b, final int offset, final int length)
+ public void readBytes(final byte[] b, final int offset, final int length)
{
try
{
@@ -244,7 +244,7 @@
}
}
- public int getInt()
+ public int readInt()
{
try
{
@@ -256,7 +256,7 @@
}
}
- public long getLong()
+ public long readLong()
{
try
{
@@ -268,12 +268,12 @@
}
}
- public float getFloat()
+ public float readFloat()
{
- return Float.intBitsToFloat(getInt());
+ return Float.intBitsToFloat(readInt());
}
- public short getShort()
+ public short readShort()
{
try
{
@@ -285,7 +285,7 @@
}
}
- public int getUnsignedShort()
+ public int readUnsignedShort()
{
try
{
@@ -297,35 +297,35 @@
}
}
- public double getDouble()
+ public double readDouble()
{
- return Double.longBitsToDouble(getLong());
+ return Double.longBitsToDouble(readLong());
}
- public char getChar()
+ public char readChar()
{
- return (char)getShort();
+ return (char)readShort();
}
- public void putBoolean(final boolean b)
+ public void writeBoolean(final boolean b)
{
if (b)
{
- putByte(TRUE);
+ writeByte(TRUE);
}
else
{
- putByte(FALSE);
+ writeByte(FALSE);
}
}
- public boolean getBoolean()
+ public boolean readBoolean()
{
- byte b = getByte();
+ byte b = readByte();
return b == TRUE;
}
- public void putString(final String nullableString)
+ public void writeString(final String nullableString)
{
flip();
buffer.writeInt(nullableString.length());
@@ -336,36 +336,36 @@
buffer.readerIndex(buffer.writerIndex());
}
- public void putNullableString(final String nullableString)
+ public void writeNullableString(final String nullableString)
{
if (nullableString == null)
{
- putByte(NULL);
+ writeByte(NULL);
}
else
{
- putByte(NOT_NULL);
- putString(nullableString);
+ writeByte(NOT_NULL);
+ writeString(nullableString);
}
}
- public String getString()
+ public String readString()
{
- int len = getInt();
+ int len = readInt();
char[] chars = new char[len];
for (int i = 0; i < len; i++)
{
- chars[i] = getChar();
+ chars[i] = readChar();
}
return new String(chars);
}
- public String getNullableString()
+ public String readNullableString()
{
- byte check = getByte();
+ byte check = readByte();
if (check == NULL)
{
@@ -373,30 +373,30 @@
}
else
{
- return getString();
+ return readString();
}
}
- public void putUTF(final String str) throws Exception
+ public void writeUTF(final String str) throws Exception
{
UTF8Util.saveUTF(this, str);
buffer.readerIndex(buffer.writerIndex());
}
- public void putNullableSimpleString(final SimpleString string)
+ public void writeNullableSimpleString(final SimpleString string)
{
if (string == null)
{
- putByte(NULL);
+ writeByte(NULL);
}
else
{
- putByte(NOT_NULL);
- putSimpleString(string);
+ writeByte(NOT_NULL);
+ writeSimpleString(string);
}
}
- public void putSimpleString(final SimpleString string)
+ public void writeSimpleString(final SimpleString string)
{
byte[] data = string.getData();
@@ -406,30 +406,30 @@
buffer.readerIndex(buffer.writerIndex());
}
- public SimpleString getSimpleString()
+ public SimpleString readSimpleString()
{
- int len = getInt();
+ int len = readInt();
byte[] data = new byte[len];
- getBytes(data);
+ readBytes(data);
return new SimpleString(data);
}
- public SimpleString getNullableSimpleString()
+ public SimpleString readNullableSimpleString()
{
- int b = getByte();
+ int b = readByte();
if (b == NULL)
{
return null;
}
else
{
- return getSimpleString();
+ return readSimpleString();
}
}
- public String getUTF() throws Exception
+ public String readUTF() throws Exception
{
return UTF8Util.readUTF(this);
}
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossBytesMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -104,7 +104,7 @@
checkRead();
try
{
- return getBody().getBoolean();
+ return getBody().readBoolean();
}
catch (BufferUnderflowException e)
{
@@ -117,7 +117,7 @@
checkRead();
try
{
- return getBody().getByte();
+ return getBody().readByte();
}
catch (BufferUnderflowException e)
{
@@ -130,7 +130,7 @@
checkRead();
try
{
- return getBody().getUnsignedByte();
+ return getBody().readUnsignedByte();
}
catch (BufferUnderflowException e)
{
@@ -143,7 +143,7 @@
checkRead();
try
{
- return getBody().getShort();
+ return getBody().readShort();
}
catch (BufferUnderflowException e)
{
@@ -156,7 +156,7 @@
checkRead();
try
{
- return getBody().getUnsignedShort();
+ return getBody().readUnsignedShort();
}
catch (BufferUnderflowException e)
{
@@ -169,7 +169,7 @@
checkRead();
try
{
- return getBody().getChar();
+ return getBody().readChar();
}
catch (BufferUnderflowException e)
{
@@ -182,7 +182,7 @@
checkRead();
try
{
- return getBody().getInt();
+ return getBody().readInt();
}
catch (BufferUnderflowException e)
{
@@ -195,7 +195,7 @@
checkRead();
try
{
- return getBody().getLong();
+ return getBody().readLong();
}
catch (BufferUnderflowException e)
{
@@ -208,7 +208,7 @@
checkRead();
try
{
- return getBody().getFloat();
+ return getBody().readFloat();
}
catch (BufferUnderflowException e)
{
@@ -221,7 +221,7 @@
checkRead();
try
{
- return getBody().getDouble();
+ return getBody().readDouble();
}
catch (BufferUnderflowException e)
{
@@ -234,7 +234,7 @@
checkRead();
try
{
- return getBody().getUTF();
+ return getBody().readUTF();
}
catch (BufferUnderflowException e)
{
@@ -264,7 +264,7 @@
if (read != 0)
{
- getBody().getBytes(value, 0, read);
+ getBody().readBytes(value, 0, read);
}
return read;
@@ -273,49 +273,49 @@
public void writeBoolean(final boolean value) throws JMSException
{
checkWrite();
- getBody().putBoolean(value);
+ getBody().writeBoolean(value);
}
public void writeByte(final byte value) throws JMSException
{
checkWrite();
- getBody().putByte(value);
+ getBody().writeByte(value);
}
public void writeShort(final short value) throws JMSException
{
checkWrite();
- getBody().putShort(value);
+ getBody().writeShort(value);
}
public void writeChar(final char value) throws JMSException
{
checkWrite();
- getBody().putChar(value);
+ getBody().writeChar(value);
}
public void writeInt(final int value) throws JMSException
{
checkWrite();
- getBody().putInt(value);
+ getBody().writeInt(value);
}
public void writeLong(final long value) throws JMSException
{
checkWrite();
- getBody().putLong(value);
+ getBody().writeLong(value);
}
public void writeFloat(final float value) throws JMSException
{
checkWrite();
- getBody().putFloat(value);
+ getBody().writeFloat(value);
}
public void writeDouble(final double value) throws JMSException
{
checkWrite();
- getBody().putDouble(value);
+ getBody().writeDouble(value);
}
public void writeUTF(final String value) throws JMSException
@@ -323,7 +323,7 @@
checkWrite();
try
{
- getBody().putUTF(value);
+ getBody().writeUTF(value);
}
catch (Exception e)
{
@@ -336,14 +336,14 @@
public void writeBytes(final byte[] value) throws JMSException
{
checkWrite();
- getBody().putBytes(value);
+ getBody().writeBytes(value);
}
public void writeBytes(final byte[] value, final int offset, final int length)
throws JMSException
{
checkWrite();
- getBody().putBytes(value, offset, length);
+ getBody().writeBytes(value, offset, length);
}
public void writeObject(final Object value) throws JMSException
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossObjectMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -104,8 +104,8 @@
{
if (data != null)
{
- getBody().putInt(data.length);
- getBody().putBytes(data);
+ getBody().writeInt(data.length);
+ getBody().writeBytes(data);
}
super.doBeforeSend();
@@ -148,9 +148,9 @@
{
try
{
- int len = getBody().getInt();
+ int len = getBody().readInt();
data = new byte[len];
- getBody().getBytes(data);
+ getBody().readBytes(data);
}
catch (Exception e)
{
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossStreamMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -119,14 +119,14 @@
checkRead();
try
{
- byte type = getBody().getByte();
+ byte type = getBody().readByte();
switch (type)
{
case DataConstants.BOOLEAN:
- return getBody().getBoolean();
+ return getBody().readBoolean();
case DataConstants.STRING:
- String s = getBody().getNullableString();
+ String s = getBody().readNullableString();
return Boolean.valueOf(s);
default:
throw new MessageFormatException("Invalid conversion");
@@ -143,13 +143,13 @@
checkRead();
try
{
- byte type = getBody().getByte();
+ byte type = getBody().readByte();
switch (type)
{
case DataConstants.BYTE:
- return getBody().getByte();
+ return getBody().readByte();
case DataConstants.STRING:
- String s = getBody().getNullableString();
+ String s = getBody().readNullableString();
return Byte.parseByte(s);
default:
throw new MessageFormatException("Invalid conversion");
@@ -166,15 +166,15 @@
checkRead();
try
{
- byte type = getBody().getByte();
+ byte type = getBody().readByte();
switch (type)
{
case DataConstants.BYTE:
- return getBody().getByte();
+ return getBody().readByte();
case DataConstants.SHORT:
- return getBody().getShort();
+ return getBody().readShort();
case DataConstants.STRING:
- String s = getBody().getNullableString();
+ String s = getBody().readNullableString();
return Short.parseShort(s);
default:
throw new MessageFormatException("Invalid conversion");
@@ -191,11 +191,11 @@
checkRead();
try
{
- byte type = getBody().getByte();
+ byte type = getBody().readByte();
switch (type)
{
case DataConstants.CHAR:
- return getBody().getChar();
+ return getBody().readChar();
default:
throw new MessageFormatException("Invalid conversion");
}
@@ -211,17 +211,17 @@
checkRead();
try
{
- byte type = getBody().getByte();
+ byte type = getBody().readByte();
switch (type)
{
case DataConstants.BYTE:
- return getBody().getByte();
+ return getBody().readByte();
case DataConstants.SHORT:
- return getBody().getShort();
+ return getBody().readShort();
case DataConstants.INT:
- return getBody().getInt();
+ return getBody().readInt();
case DataConstants.STRING:
- String s = getBody().getNullableString();
+ String s = getBody().readNullableString();
return Integer.parseInt(s);
default:
throw new MessageFormatException("Invalid conversion");
@@ -238,19 +238,19 @@
checkRead();
try
{
- byte type = getBody().getByte();
+ byte type = getBody().readByte();
switch (type)
{
case DataConstants.BYTE:
- return getBody().getByte();
+ return getBody().readByte();
case DataConstants.SHORT:
- return getBody().getShort();
+ return getBody().readShort();
case DataConstants.INT:
- return getBody().getInt();
+ return getBody().readInt();
case DataConstants.LONG:
- return getBody().getLong();
+ return getBody().readLong();
case DataConstants.STRING:
- String s = getBody().getNullableString();
+ String s = getBody().readNullableString();
return Long.parseLong(s);
default:
throw new MessageFormatException("Invalid conversion");
@@ -267,13 +267,13 @@
checkRead();
try
{
- byte type = getBody().getByte();
+ byte type = getBody().readByte();
switch (type)
{
case DataConstants.FLOAT:
- return getBody().getFloat();
+ return getBody().readFloat();
case DataConstants.STRING:
- String s = getBody().getNullableString();
+ String s = getBody().readNullableString();
return Float.parseFloat(s);
default:
throw new MessageFormatException("Invalid conversion");
@@ -290,15 +290,15 @@
checkRead();
try
{
- byte type = getBody().getByte();
+ byte type = getBody().readByte();
switch (type)
{
case DataConstants.FLOAT:
- return getBody().getFloat();
+ return getBody().readFloat();
case DataConstants.DOUBLE:
- return getBody().getDouble();
+ return getBody().readDouble();
case DataConstants.STRING:
- String s = getBody().getNullableString();
+ String s = getBody().readNullableString();
return Double.parseDouble(s);
default:
throw new MessageFormatException("Invalid conversion: " + type);
@@ -315,27 +315,27 @@
checkRead();
try
{
- byte type = getBody().getByte();
+ byte type = getBody().readByte();
switch (type)
{
case DataConstants.BOOLEAN:
- return String.valueOf(getBody().getBoolean());
+ return String.valueOf(getBody().readBoolean());
case DataConstants.BYTE:
- return String.valueOf(getBody().getByte());
+ return String.valueOf(getBody().readByte());
case DataConstants.SHORT:
- return String.valueOf(getBody().getShort());
+ return String.valueOf(getBody().readShort());
case DataConstants.CHAR:
- return String.valueOf(getBody().getChar());
+ return String.valueOf(getBody().readChar());
case DataConstants.INT:
- return String.valueOf(getBody().getInt());
+ return String.valueOf(getBody().readInt());
case DataConstants.LONG:
- return String.valueOf(getBody().getLong());
+ return String.valueOf(getBody().readLong());
case DataConstants.FLOAT:
- return String.valueOf(getBody().getFloat());
+ return String.valueOf(getBody().readFloat());
case DataConstants.DOUBLE:
- return String.valueOf(getBody().getDouble());
+ return String.valueOf(getBody().readDouble());
case DataConstants.STRING:
- return getBody().getNullableString();
+ return getBody().readNullableString();
default:
throw new MessageFormatException("Invalid conversion");
}
@@ -360,15 +360,15 @@
}
else if (len == 0)
{
- byte type = getBody().getByte();
+ byte type = getBody().readByte();
if (type != DataConstants.BYTES)
{
throw new MessageFormatException("Invalid conversion");
}
- len = getBody().getInt();
+ len = getBody().readInt();
}
int read = Math.min(value.length, len);
- getBody().getBytes(value, 0, read);
+ getBody().readBytes(value, 0, read);
len -= read;
if (len == 0)
{
@@ -385,31 +385,31 @@
public Object readObject() throws JMSException
{
checkRead();
- byte type = getBody().getByte();
+ byte type = getBody().readByte();
switch (type)
{
case DataConstants.BOOLEAN:
- return getBody().getBoolean();
+ return getBody().readBoolean();
case DataConstants.BYTE:
- return getBody().getByte();
+ return getBody().readByte();
case DataConstants.SHORT:
- return getBody().getShort();
+ return getBody().readShort();
case DataConstants.CHAR:
- return getBody().getChar();
+ return getBody().readChar();
case DataConstants.INT:
- return getBody().getInt();
+ return getBody().readInt();
case DataConstants.LONG:
- return getBody().getLong();
+ return getBody().readLong();
case DataConstants.FLOAT:
- return getBody().getFloat();
+ return getBody().readFloat();
case DataConstants.DOUBLE:
- return getBody().getDouble();
+ return getBody().readDouble();
case DataConstants.STRING:
- return getBody().getNullableString();
+ return getBody().readNullableString();
case DataConstants.BYTES:
- int len = getBody().getInt();
+ int len = getBody().readInt();
byte[] bytes = new byte[len];
- getBody().getBytes(bytes);
+ getBody().readBytes(bytes);
return bytes;
default:
throw new MessageFormatException("Invalid conversion");
@@ -419,81 +419,81 @@
public void writeBoolean(final boolean value) throws JMSException
{
checkWrite();
- getBody().putByte(DataConstants.BOOLEAN);
- getBody().putBoolean(value);
+ getBody().writeByte(DataConstants.BOOLEAN);
+ getBody().writeBoolean(value);
}
public void writeByte(final byte value) throws JMSException
{
checkWrite();
- getBody().putByte(DataConstants.BYTE);
- getBody().putByte(value);
+ getBody().writeByte(DataConstants.BYTE);
+ getBody().writeByte(value);
}
public void writeShort(final short value) throws JMSException
{
checkWrite();
- getBody().putByte(DataConstants.SHORT);
- getBody().putShort(value);
+ getBody().writeByte(DataConstants.SHORT);
+ getBody().writeShort(value);
}
public void writeChar(final char value) throws JMSException
{
checkWrite();
- getBody().putByte(DataConstants.CHAR);
- getBody().putChar(value);
+ getBody().writeByte(DataConstants.CHAR);
+ getBody().writeChar(value);
}
public void writeInt(final int value) throws JMSException
{
checkWrite();
- getBody().putByte(DataConstants.INT);
- getBody().putInt(value);
+ getBody().writeByte(DataConstants.INT);
+ getBody().writeInt(value);
}
public void writeLong(final long value) throws JMSException
{
checkWrite();
- getBody().putByte(DataConstants.LONG);
- getBody().putLong(value);
+ getBody().writeByte(DataConstants.LONG);
+ getBody().writeLong(value);
}
public void writeFloat(final float value) throws JMSException
{
checkWrite();
- getBody().putByte(DataConstants.FLOAT);
- getBody().putFloat(value);
+ getBody().writeByte(DataConstants.FLOAT);
+ getBody().writeFloat(value);
}
public void writeDouble(final double value) throws JMSException
{
checkWrite();
- getBody().putByte(DataConstants.DOUBLE);
- getBody().putDouble(value);
+ getBody().writeByte(DataConstants.DOUBLE);
+ getBody().writeDouble(value);
}
public void writeString(final String value) throws JMSException
{
checkWrite();
- getBody().putByte(DataConstants.STRING);
- getBody().putNullableString(value);
+ getBody().writeByte(DataConstants.STRING);
+ getBody().writeNullableString(value);
}
public void writeBytes(final byte[] value) throws JMSException
{
checkWrite();
- getBody().putByte(DataConstants.BYTES);
- getBody().putInt(value.length);
- getBody().putBytes(value);
+ getBody().writeByte(DataConstants.BYTES);
+ getBody().writeInt(value.length);
+ getBody().writeBytes(value);
}
public void writeBytes(final byte[] value, final int offset, final int length)
throws JMSException
{
checkWrite();
- getBody().putByte(DataConstants.BYTES);
- getBody().putInt(length);
- getBody().putBytes(value, offset, length);
+ getBody().writeByte(DataConstants.BYTES);
+ getBody().writeInt(length);
+ getBody().writeBytes(value, offset, length);
}
public void writeObject(final Object value) throws JMSException
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossTextMessage.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossTextMessage.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/jms/client/JBossTextMessage.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -124,7 +124,7 @@
public void doBeforeSend() throws Exception
{
- getBody().putNullableString(text);
+ getBody().writeNullableString(text);
super.doBeforeSend();
}
@@ -133,7 +133,7 @@
{
super.doBeforeReceive();
- text = getBody().getNullableString();
+ text = getBody().readNullableString();
}
// Package protected ---------------------------------------------
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/util/TypedProperties.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/util/TypedProperties.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/util/TypedProperties.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -191,7 +191,7 @@
public synchronized void decode(final MessagingBuffer buffer)
{
- byte b = buffer.getByte();
+ byte b = buffer.readByte();
if (b == NULL)
{
@@ -199,19 +199,19 @@
}
else
{
- int numHeaders = buffer.getInt();
+ int numHeaders = buffer.readInt();
properties = new HashMap<SimpleString, PropertyValue>(numHeaders);
size = 0;
for (int i = 0; i < numHeaders; i++)
{
- int len = buffer.getInt();
+ int len = buffer.readInt();
byte[] data = new byte[len];
- buffer.getBytes(data);
+ buffer.readBytes(data);
SimpleString key = new SimpleString(data);
- byte type = buffer.getByte();
+ byte type = buffer.readByte();
PropertyValue val;
@@ -296,20 +296,20 @@
{
if (properties == null)
{
- buffer.putByte(NULL);
+ buffer.writeByte(NULL);
}
else
{
- buffer.putByte(NOT_NULL);
+ buffer.writeByte(NOT_NULL);
- buffer.putInt(properties.size());
+ buffer.writeInt(properties.size());
for (Map.Entry<SimpleString, PropertyValue> entry : properties.entrySet())
{
SimpleString s = entry.getKey();
byte[] data = s.getData();
- buffer.putInt(data.length);
- buffer.putBytes(data);
+ buffer.writeInt(data.length);
+ buffer.writeBytes(data);
entry.getValue().write(buffer);
}
@@ -424,7 +424,7 @@
public void write(final MessagingBuffer buffer)
{
- buffer.putByte(NULL);
+ buffer.writeByte(NULL);
}
public int encodeSize()
@@ -445,7 +445,7 @@
public BooleanValue(final MessagingBuffer buffer)
{
- val = buffer.getBoolean();
+ val = buffer.readBoolean();
}
public Object getValue()
@@ -455,8 +455,8 @@
public void write(final MessagingBuffer buffer)
{
- buffer.putByte(BOOLEAN);
- buffer.putBoolean(val);
+ buffer.writeByte(BOOLEAN);
+ buffer.writeBoolean(val);
}
public int encodeSize()
@@ -477,7 +477,7 @@
public ByteValue(final MessagingBuffer buffer)
{
- val = buffer.getByte();
+ val = buffer.readByte();
}
public Object getValue()
@@ -487,8 +487,8 @@
public void write(final MessagingBuffer buffer)
{
- buffer.putByte(BYTE);
- buffer.putByte(val);
+ buffer.writeByte(BYTE);
+ buffer.writeByte(val);
}
public int encodeSize()
@@ -508,9 +508,9 @@
public BytesValue(final MessagingBuffer buffer)
{
- int len = buffer.getInt();
+ int len = buffer.readInt();
val = new byte[len];
- buffer.getBytes(val);
+ buffer.readBytes(val);
}
public Object getValue()
@@ -520,9 +520,9 @@
public void write(final MessagingBuffer buffer)
{
- buffer.putByte(BYTES);
- buffer.putInt(val.length);
- buffer.putBytes(val);
+ buffer.writeByte(BYTES);
+ buffer.writeInt(val.length);
+ buffer.writeBytes(val);
}
public int encodeSize()
@@ -543,7 +543,7 @@
public ShortValue(final MessagingBuffer buffer)
{
- val = buffer.getShort();
+ val = buffer.readShort();
}
public Object getValue()
@@ -553,8 +553,8 @@
public void write(final MessagingBuffer buffer)
{
- buffer.putByte(SHORT);
- buffer.putShort(val);
+ buffer.writeByte(SHORT);
+ buffer.writeShort(val);
}
public int encodeSize()
@@ -574,7 +574,7 @@
public IntValue(final MessagingBuffer buffer)
{
- val = buffer.getInt();
+ val = buffer.readInt();
}
public Object getValue()
@@ -584,8 +584,8 @@
public void write(final MessagingBuffer buffer)
{
- buffer.putByte(INT);
- buffer.putInt(val);
+ buffer.writeByte(INT);
+ buffer.writeInt(val);
}
public int encodeSize()
@@ -605,7 +605,7 @@
public LongValue(final MessagingBuffer buffer)
{
- val = buffer.getLong();
+ val = buffer.readLong();
}
public Object getValue()
@@ -615,8 +615,8 @@
public void write(final MessagingBuffer buffer)
{
- buffer.putByte(LONG);
- buffer.putLong(val);
+ buffer.writeByte(LONG);
+ buffer.writeLong(val);
}
public int encodeSize()
@@ -636,7 +636,7 @@
public FloatValue(final MessagingBuffer buffer)
{
- val = buffer.getFloat();
+ val = buffer.readFloat();
}
public Object getValue()
@@ -646,8 +646,8 @@
public void write(final MessagingBuffer buffer)
{
- buffer.putByte(FLOAT);
- buffer.putFloat(val);
+ buffer.writeByte(FLOAT);
+ buffer.writeFloat(val);
}
public int encodeSize()
@@ -668,7 +668,7 @@
public DoubleValue(final MessagingBuffer buffer)
{
- val = buffer.getDouble();
+ val = buffer.readDouble();
}
public Object getValue()
@@ -678,8 +678,8 @@
public void write(final MessagingBuffer buffer)
{
- buffer.putByte(DOUBLE);
- buffer.putDouble(val);
+ buffer.writeByte(DOUBLE);
+ buffer.writeDouble(val);
}
public int encodeSize()
@@ -699,7 +699,7 @@
public CharValue(final MessagingBuffer buffer)
{
- val = buffer.getChar();
+ val = buffer.readChar();
}
public Object getValue()
@@ -709,8 +709,8 @@
public void write(final MessagingBuffer buffer)
{
- buffer.putByte(CHAR);
- buffer.putChar(val);
+ buffer.writeByte(CHAR);
+ buffer.writeChar(val);
}
public int encodeSize()
@@ -730,7 +730,7 @@
public StringValue(final MessagingBuffer buffer)
{
- val = buffer.getSimpleString();
+ val = buffer.readSimpleString();
}
public Object getValue()
@@ -740,8 +740,8 @@
public void write(final MessagingBuffer buffer)
{
- buffer.putByte(STRING);
- buffer.putSimpleString(val);
+ buffer.writeByte(STRING);
+ buffer.writeSimpleString(val);
}
public int encodeSize()
Modified: branches/JBMESSAGING_1394/src/main/org/jboss/messaging/util/UTF8Util.java
===================================================================
--- branches/JBMESSAGING_1394/src/main/org/jboss/messaging/util/UTF8Util.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/src/main/org/jboss/messaging/util/UTF8Util.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -66,7 +66,7 @@
throw new IllegalArgumentException("the encoded string is too long (" + len + ")");
}
- out.putShort((short)len);
+ out.writeShort((short)len);
if (len > buffer.byteBuffer.length)
{
@@ -79,7 +79,7 @@
{
buffer.byteBuffer[byteLocation] = (byte)buffer.charBuffer[byteLocation];
}
- out.putBytes(buffer.byteBuffer, 0, len);
+ out.writeBytes(buffer.byteBuffer, 0, len);
}
else
{
@@ -112,7 +112,7 @@
}
}
- out.putBytes(buffer.byteBuffer, 0, len);
+ out.writeBytes(buffer.byteBuffer, 0, len);
}
}
@@ -120,7 +120,7 @@
{
StringUtilBuffer buffer = getThreadLocalBuffer();
- final int size = input.getUnsignedShort();
+ final int size = input.readUnsignedShort();
if (size > buffer.byteBuffer.length)
{
@@ -141,7 +141,7 @@
int byte1, byte2, byte3;
int charCount = 0;
- input.getBytes(buffer.byteBuffer, 0, size);
+ input.readBytes(buffer.byteBuffer, 0, size);
while (count < size)
{
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/AutoGroupClientTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/AutoGroupClientTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/AutoGroupClientTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -96,7 +96,7 @@
{
ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
System.currentTimeMillis(), (byte) 1);
- message.getBody().putString("testINVMCoreClient");
+ message.getBody().writeString("testINVMCoreClient");
message.getBody().flip();
message.setDurable(false);
producer.send(message);
@@ -158,7 +158,7 @@
{
ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
System.currentTimeMillis(), (byte) 1);
- message.getBody().putString("testINVMCoreClient");
+ message.getBody().writeString("testINVMCoreClient");
message.getBody().flip();
producer.send(message);
}
@@ -166,7 +166,7 @@
{
ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
System.currentTimeMillis(), (byte) 1);
- message.getBody().putString("testINVMCoreClient");
+ message.getBody().writeString("testINVMCoreClient");
message.getBody().flip();
producer2.send(message);
}
@@ -222,7 +222,7 @@
{
ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
System.currentTimeMillis(), (byte) 1);
- message.getBody().putString("testINVMCoreClient");
+ message.getBody().writeString("testINVMCoreClient");
message.getBody().flip();
message.setDurable(false);
producer.send(message);
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/CoreClientTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -54,10 +54,18 @@
// Public --------------------------------------------------------
- public void testCoreClient() throws Exception
+ public void testCoreClientNetty() throws Exception
{
+ testCoreClient("org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory", "org.jboss.messaging.integration.transports.netty.NettyConnectorFactory");
+ }
+
+ public void testCoreClientMina() throws Exception
+ {
testCoreClient("org.jboss.messaging.integration.transports.mina.MinaAcceptorFactory", "org.jboss.messaging.integration.transports.mina.MinaConnectorFactory");
- testCoreClient("org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory", "org.jboss.messaging.integration.transports.netty.NettyConnectorFactory");
+ }
+
+ public void testCoreClientInVM() throws Exception
+ {
testCoreClient("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory", "org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory");
}
@@ -89,7 +97,7 @@
{
ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
System.currentTimeMillis(), (byte) 1);
- message.getBody().putString("testINVMCoreClient");
+ message.getBody().writeString("testINVMCoreClient");
message.getBody().flip();
producer.send(message);
}
@@ -102,7 +110,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("testINVMCoreClient", message2.getBody().getString());
+ assertEquals("testINVMCoreClient", message2.getBody().readString());
message2.acknowledge();
}
Added: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/SelfExpandingBufferTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/SelfExpandingBufferTest.java (rev 0)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/basic/SelfExpandingBufferTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.basic;
+
+import org.jboss.messaging.core.client.ClientConsumer;
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientProducer;
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.tests.util.ServiceTestBase;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * A SelfExpandingBufferTest
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ * Created Feb 23, 2009 4:27:16 PM
+ *
+ *
+ */
+public class SelfExpandingBufferTest extends ServiceTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ MessagingService service;
+
+ SimpleString ADDRESS = new SimpleString("Address");
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testSelfExpandingBufferNetty() throws Exception
+ {
+ testSelfExpandingBuffer(true);
+ }
+
+ public void testSelfExpandingBufferInVM() throws Exception
+ {
+ testSelfExpandingBuffer(false);
+ }
+
+ public void testSelfExpandingBuffer(boolean netty) throws Exception
+ {
+
+ setUpService(true);
+
+ ClientSessionFactory factory;
+
+ if (netty)
+ {
+ factory = createNettyFactory();
+ }
+ else
+ {
+ factory = createInVMFactory();
+ }
+
+ ClientSession session = factory.createSession(false, true, true);
+
+ try
+ {
+
+ session.createQueue(ADDRESS, ADDRESS, true);
+
+ ClientMessage msg = session.createClientMessage(true);
+
+ MessagingBuffer buffer = msg.getBody();
+
+ for (int i = 0; i < 10; i++)
+ {
+ buffer.writeBytes(new byte[1024]);
+ }
+ buffer.flip();
+
+ ClientProducer prod = session.createProducer(ADDRESS);
+
+ prod.send(msg);
+
+ ClientConsumer cons = session.createConsumer(ADDRESS);
+
+ session.start();
+
+ ClientMessage msg2 = cons.receive(3000);
+ assertNotNull(msg2);
+
+
+ assertEquals(1024 * 10, msg2.getBodySize());
+
+
+ }
+ finally
+ {
+ session.close();
+ }
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected void setUpService(boolean netty) throws Exception
+ {
+ service = createService(false, createDefaultConfig(netty));
+ service.start();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ if (service != null && service.isStarted())
+ {
+ service.stop();
+ }
+
+ super.tearDown();
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/chunkmessage/ChunkTestBase.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -300,7 +300,7 @@
assertEquals(numberOfIntegers * DataConstants.SIZE_INT, buffer.limit());
for (int b = 0; b < numberOfIntegers; b++)
{
- assertEquals(b, buffer.getInt());
+ assertEquals(b, buffer.readInt());
}
}
}
@@ -344,7 +344,7 @@
for (int i = 0; i < numberOfIntegers; i++)
{
- body.putInt(i);
+ body.writeInt(i);
}
body.flip();
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -670,7 +670,7 @@
for (int j = 1; j <= numberOfIntegers; j++)
{
- bodyLocal.putInt(j);
+ bodyLocal.writeInt(j);
}
bodyLocal.flip();
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientCrashTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -118,7 +118,7 @@
// send the message to the queue
Message messageFromClient = consumer.receive(5000);
assertNotNull("no message received", messageFromClient);
- assertEquals(MESSAGE_TEXT_FROM_CLIENT, messageFromClient.getBody().getString());
+ assertEquals(MESSAGE_TEXT_FROM_CLIENT, messageFromClient.getBody().readString());
assertActiveConnections(1 + 1); // One local and one from the other vm
@@ -127,7 +127,7 @@
0,
System.currentTimeMillis(),
(byte)1);
- message.getBody().putString(ClientCrashTest.MESSAGE_TEXT_FROM_SERVER);
+ message.getBody().writeString(ClientCrashTest.MESSAGE_TEXT_FROM_SERVER);
producer.send(message);
log.debug("waiting for the client VM to crash ...");
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/ClientExitTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -86,7 +86,7 @@
Message message = consumer.receive(15000);
assertNotNull(message);
- assertEquals(MESSAGE_TEXT, message.getBody().getString());
+ assertEquals(MESSAGE_TEXT, message.getBody().readString());
// the client VM should exit by itself. If it doesn't, that means we have a problem
// and the test will timeout
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/CrashClient.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -85,7 +85,7 @@
ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
System.currentTimeMillis(), (byte) 1);
- message.getBody().putString(ClientCrashTest.MESSAGE_TEXT_FROM_CLIENT);
+ message.getBody().writeString(ClientCrashTest.MESSAGE_TEXT_FROM_CLIENT);
producer.send(message);
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/clientcrash/GracefulClient.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -70,7 +70,7 @@
ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
System.currentTimeMillis(), (byte) 1);
- message.getBody().putString(messageText);
+ message.getBody().writeString(messageText);
producer.send(message);
session.start();
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/BridgeTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -369,7 +369,7 @@
message.putStringProperty(propKey, new SimpleString("bing"));
- message.getBody().putString("doo be doo be doo be doo");
+ message.getBody().writeString("doo be doo be doo be doo");
message.getBody().flip();
@@ -386,7 +386,7 @@
assertEquals(new SimpleString("bong"), val);
- String sval = message.getBody().getString();
+ String sval = message.getBody().readString();
assertEquals("dee be dee be dee be dee", sval);
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/SimpleTransformer.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/SimpleTransformer.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/bridge/SimpleTransformer.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -57,7 +57,7 @@
//Change the body
MessagingBuffer buffer = message.getBody();
- String str = buffer.getString();
+ String str = buffer.readString();
if (!str.equals("doo be doo be doo be doo"))
{
@@ -66,7 +66,7 @@
buffer.flip();
- buffer.putString("dee be dee be dee be dee");
+ buffer.writeString("dee be dee be dee be dee");
return message;
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ActivationTimeoutTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -109,7 +109,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -147,7 +147,7 @@
assertTrue(now - start >= ACTIVATION_TIMEOUT);
}
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
@@ -196,7 +196,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -238,7 +238,7 @@
assertTrue(now - start >= ACTIVATION_TIMEOUT);
}
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/AutomaticFailoverWithDiscoveryTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -108,7 +108,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -126,7 +126,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
@@ -145,7 +145,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailBackupServerTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -104,7 +104,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -119,7 +119,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
@@ -149,7 +149,7 @@
{
message = session1.createClientMessage(JBossTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -160,7 +160,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
@@ -197,7 +197,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -208,7 +208,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverExpiredMessageTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -114,7 +114,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverNoSessionsFailoverTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -100,7 +100,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -115,7 +115,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
@@ -147,7 +147,7 @@
System.currentTimeMillis(),
(byte)1);
message2.putIntProperty(new SimpleString("count"), i);
- message2.getBody().putString("aardvarks");
+ message2.getBody().writeString("aardvarks");
message2.getBody().flip();
producer2.send(message2);
}
@@ -162,7 +162,7 @@
assertNotNull(message2);
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverPreAcknowledgeTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -93,7 +93,7 @@
ClientMessage message = session1.createClientMessage(JBossTextMessage.TYPE,
false);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("more aardvarks");
+ message.getBody().writeString("more aardvarks");
message.getBody().flip();
producer.send(message);
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailoverScheduledMessageTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -115,7 +115,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
long deliveryTime = now + delay * i;
message.putLongProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME, deliveryTime);
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/FailureOnCreateConnectionTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -146,7 +146,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -165,7 +165,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/JustReplicationTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/JustReplicationTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/JustReplicationTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -190,7 +190,7 @@
assertEquals(numberOfBytes, buffer.limit());
- assertEquals(i, buffer.getInt());
+ assertEquals(i, buffer.readInt());
}
assertNull(consumer.receive(500));
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -147,7 +147,7 @@
message.getBody().rewind();
- assertEquals(i, message.getBody().getInt());
+ assertEquals(i, message.getBody().readInt());
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -112,7 +112,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -131,7 +131,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
@@ -188,7 +188,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -228,7 +228,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
@@ -278,7 +278,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -358,7 +358,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -400,7 +400,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
@@ -450,7 +450,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -491,7 +491,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
@@ -545,7 +545,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -587,7 +587,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/ReconnectWithBackupTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -120,7 +120,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -138,7 +138,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
@@ -193,7 +193,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -211,7 +211,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
@@ -234,7 +234,7 @@
{
message = session.createClientMessage(JBossTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -253,7 +253,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
assertEquals(i, message.getProperty(new SimpleString("count")));
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -106,7 +106,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -123,7 +123,7 @@
// log.info("Got message " + message2);
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
message2.acknowledge();
@@ -160,7 +160,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -178,7 +178,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
@@ -197,7 +197,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
@@ -239,7 +239,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -257,7 +257,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
@@ -279,7 +279,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
@@ -321,7 +321,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -339,7 +339,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
@@ -390,7 +390,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -408,7 +408,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
@@ -482,7 +482,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -500,7 +500,7 @@
{
ClientMessage message2 = cons.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(j, message2.getProperty(new SimpleString("count")));
@@ -631,7 +631,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -651,7 +651,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
@@ -741,7 +741,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), k);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -754,7 +754,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(k, message2.getProperty(new SimpleString("count")));
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleManualFailoverTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -97,7 +97,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -110,7 +110,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("aardvarks", message2.getBody().getString());
+ assertEquals("aardvarks", message2.getBody().readString());
assertEquals(i, message2.getProperty(new SimpleString("count")));
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SplitBrainTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -112,7 +112,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), sendCount++);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -143,7 +143,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
int count = (Integer)message.getProperty(new SimpleString("count"));
@@ -178,7 +178,7 @@
System.currentTimeMillis(),
(byte)1);
message.putIntProperty(new SimpleString("count"), i + numMessages);
- message.getBody().putString("aardvarks");
+ message.getBody().writeString("aardvarks");
message.getBody().flip();
producer.send(message);
}
@@ -191,7 +191,7 @@
assertNotNull(message);
- assertEquals("aardvarks", message.getBody().getString());
+ assertEquals("aardvarks", message.getBody().readString());
int count = (Integer)message.getProperty(new SimpleString("count"));
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/consumer/ConsumerTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/consumer/ConsumerTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/consumer/ConsumerTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -101,7 +101,7 @@
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
consumer.close();
@@ -112,7 +112,7 @@
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
consumer.close();
@@ -147,7 +147,7 @@
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
consumer.close();
@@ -158,7 +158,7 @@
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
consumer.close();
@@ -196,7 +196,7 @@
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
session.close();
@@ -229,11 +229,11 @@
for (int i = 0; i < numMessages; i++)
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
message2 = consumer2.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
message2 = consumer3.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
session.close();
@@ -267,17 +267,17 @@
for (int i = 0; i < 50; i++)
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
for (int i = 50; i < numMessages; i++)
{
ClientMessage message2 = consumer2.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
for (int i = 0; i < numMessages; i++)
{
ClientMessage message2 = consumer3.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
session.close();
@@ -319,7 +319,7 @@
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
// assert that all the messages are there and none have been acked
assertEquals(0,
@@ -356,7 +356,7 @@
message2.acknowledge();
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
// assert that all the messages are there and none have been acked
assertEquals(0,
@@ -452,7 +452,7 @@
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
// assert that all the messages are there and none have been acked
assertEquals(0,
@@ -488,7 +488,7 @@
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
}
// assert that all the messages are there and none have been acked
assertEquals(0,
@@ -524,7 +524,7 @@
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
if (i < 50)
{
message2.acknowledge();
@@ -564,7 +564,7 @@
{
ClientMessage message2 = consumer.receive(1000);
- assertEquals("m" + i, message2.getBody().getString());
+ assertEquals("m" + i, message2.getBody().readString());
if (i < 50)
{
message2.acknowledge();
@@ -591,7 +591,7 @@
0,
System.currentTimeMillis(),
(byte)1);
- message.getBody().putString(msg);
+ message.getBody().writeString(msg);
message.getBody().flip();
return message;
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/http/CoreClientOverHttpTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -73,7 +73,7 @@
{
ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
System.currentTimeMillis(), (byte) 1);
- message.getBody().putString("CoreClientOverHttpTest");
+ message.getBody().writeString("CoreClientOverHttpTest");
message.getBody().flip();
producer.send(message);
}
@@ -86,7 +86,7 @@
{
ClientMessage message2 = consumer.receive();
- assertEquals("CoreClientOverHttpTest", message2.getBody().getString());
+ assertEquals("CoreClientOverHttpTest", message2.getBody().readString());
message2.acknowledge();
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/http/NettyHttpTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/http/NettyHttpTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/http/NettyHttpTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -69,13 +69,13 @@
for (int i = 0; i < numPackets; i++)
{
MessagingBuffer buff = conn.createBuffer(8);
- buff.putInt(4);
- buff.putInt(i);
+ buff.writeInt(4);
+ buff.writeInt(i);
buff.flip();
conn.write(buff);
buff = conn.createBuffer(8);
- buff.putInt(4);
- buff.putInt(i);
+ buff.writeInt(4);
+ buff.writeInt(i);
buff.flip();
acceptorListener.connection.write(buff);
}
@@ -121,16 +121,16 @@
for (int i = 0; i < numPackets; i++)
{
MessagingBuffer buff = conn.createBuffer(8);
- buff.putInt(4);
- buff.putInt(i);
+ buff.writeInt(4);
+ buff.writeInt(i);
buff.flip();
conn.write(buff);
}
for (int i = 0; i < numPackets; i++)
{
MessagingBuffer buff = conn.createBuffer(8);
- buff.putInt(4);
- buff.putInt(i);
+ buff.writeInt(4);
+ buff.writeInt(i);
buff.flip();
acceptorListener.connection.write(buff);
}
@@ -176,8 +176,8 @@
for (int i = 0; i < numPackets; i++)
{
MessagingBuffer buff = conn.createBuffer(8);
- buff.putInt(4);
- buff.putInt(i);
+ buff.writeInt(4);
+ buff.writeInt(i);
buff.flip();
acceptorListener.connection.write(buff);
}
@@ -185,8 +185,8 @@
for (int i = 0; i < numPackets; i++)
{
MessagingBuffer buff = conn.createBuffer(8);
- buff.putInt(4);
- buff.putInt(i);
+ buff.writeInt(4);
+ buff.writeInt(i);
buff.flip();
conn.write(buff);
}
@@ -232,16 +232,16 @@
for (int i = 0; i < numPackets; i++)
{
MessagingBuffer buff = conn.createBuffer(8);
- buff.putInt(4);
- buff.putInt(i);
+ buff.writeInt(4);
+ buff.writeInt(i);
buff.flip();
acceptorListener.connection.write(buff);
}
MessagingBuffer buff = conn.createBuffer(8);
- buff.putInt(4);
- buff.putInt(0);
+ buff.writeInt(4);
+ buff.writeInt(0);
buff.flip();
conn.write(buff);
@@ -288,8 +288,8 @@
for (int i = 0; i < numPackets; i++)
{
MessagingBuffer buff = conn.createBuffer(8);
- buff.putInt(4);
- buff.putInt(i);
+ buff.writeInt(4);
+ buff.writeInt(i);
buff.flip();
acceptorListener.connection.write(buff);
}
@@ -338,8 +338,8 @@
for (int i = 0; i < numPackets; i++)
{
MessagingBuffer buff = conn.createBuffer(8);
- buff.putInt(4);
- buff.putInt(i);
+ buff.writeInt(4);
+ buff.writeInt(i);
buff.flip();
conn.write(buff);
}
@@ -389,7 +389,7 @@
public void bufferReceived(Object connectionID, MessagingBuffer buffer)
{
- int i = buffer.getInt();
+ int i = buffer.readInt();
messages.add(i);
messagesReceieved++;
latch.countDown();
@@ -415,7 +415,7 @@
public void bufferReceived(Object connectionID, MessagingBuffer buffer)
{
- int i = buffer.getInt();
+ int i = buffer.readInt();
messages.add(i);
messagesReceieved++;
latch.countDown();
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/paging/PagingServiceIntegrationTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/paging/PagingServiceIntegrationTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/paging/PagingServiceIntegrationTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -118,7 +118,7 @@
for (int j = 1; j <= numberOfIntegers; j++)
{
- bodyLocal.putInt(j);
+ bodyLocal.writeInt(j);
}
bodyLocal.flip();
@@ -388,7 +388,7 @@
for (int j = 1; j <= numberOfIntegers; j++)
{
- bodyLocal.putInt(j);
+ bodyLocal.writeInt(j);
}
bodyLocal.flip();
@@ -518,7 +518,7 @@
for (int j = 1; j <= numberOfIntegers; j++)
{
- bodyLocal.putInt(j);
+ bodyLocal.writeInt(j);
}
bodyLocal.flip();
@@ -597,7 +597,7 @@
for (int j = 1; j <= numberOfIntegers; j++)
{
- bodyLocal.putInt(j);
+ bodyLocal.writeInt(j);
}
bodyLocal.flip();
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/DeadLetterAddressTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/DeadLetterAddressTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/DeadLetterAddressTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -74,7 +74,7 @@
ClientMessage m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "heyho!");
+ assertEquals(m.getBody().readString(), "heyho!");
//force a cancel
clientSession.end(xid, XAResource.TMSUCCESS);
clientSession.rollback(xid);
@@ -84,7 +84,7 @@
clientConsumer = clientSession.createConsumer(dlq);
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "heyho!");
+ assertEquals(m.getBody().readString(), "heyho!");
}
public void testBasicSendToMultipleQueues() throws Exception
@@ -109,7 +109,7 @@
ClientMessage m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "heyho!");
+ assertEquals(m.getBody().readString(), "heyho!");
//force a cancel
clientSession.end(xid, XAResource.TMSUCCESS);
clientSession.rollback(xid);
@@ -121,13 +121,13 @@
m = clientConsumer.receive(500);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "heyho!");
+ assertEquals(m.getBody().readString(), "heyho!");
clientConsumer.close();
clientConsumer = clientSession.createConsumer(dlq2);
m = clientConsumer.receive(500);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "heyho!");
+ assertEquals(m.getBody().readString(), "heyho!");
clientConsumer.close();
}
@@ -147,7 +147,7 @@
ClientMessage m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "heyho!");
+ assertEquals(m.getBody().readString(), "heyho!");
//force a cancel
clientSession.end(xid, XAResource.TMSUCCESS);
clientSession.rollback(xid);
@@ -197,7 +197,7 @@
{
origIds.put("Message:" + j, tm.getMessageID());
}
- assertEquals("Message:" + j, tm.getBody().getString());
+ assertEquals("Message:" + j, tm.getBody().readString());
}
clientSession.end(xid, XAResource.TMSUCCESS);
clientSession.rollback(xid);
@@ -216,7 +216,7 @@
assertNotNull(tm);
- String text = tm.getBody().getString();
+ String text = tm.getBody().readString();
assertEquals("Message:" + i, text);
// Check the headers
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryAddressTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryAddressTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryAddressTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -77,7 +77,7 @@
clientConsumer = clientSession.createConsumer(eq);
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "heyho!");
+ assertEquals(m.getBody().readString(), "heyho!");
m.acknowledge();
// PageSize should be the same as when it started
@@ -125,7 +125,7 @@
log.info("acking");
m.acknowledge();
- assertEquals(m.getBody().getString(), "heyho!");
+ assertEquals(m.getBody().readString(), "heyho!");
clientConsumer.close();
@@ -138,7 +138,7 @@
log.info("acking");
m.acknowledge();
- assertEquals(m.getBody().getString(), "heyho!");
+ assertEquals(m.getBody().readString(), "heyho!");
clientConsumer.close();
@@ -205,7 +205,7 @@
assertNotNull(tm);
- String text = tm.getBody().getString();
+ String text = tm.getBody().readString();
assertEquals("Message:" + i, text);
// Check the headers
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryRunnerTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryRunnerTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/ExpiryRunnerTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -170,7 +170,7 @@
ClientMessage cm = consumer.receive(500);
assertNotNull("message not received " + i, cm);
cm.acknowledge();
- assertEquals("m" + i, cm.getBody().getString());
+ assertEquals("m" + i, cm.getBody().readString());
}
consumer.close();
Thread.sleep(2100);
@@ -254,7 +254,7 @@
{
break;
}
- String text = cm.getBody().getString();
+ String text = cm.getBody().readString();
cm.acknowledge();
assertFalse(dummyMessageHandler.payloads.contains(text));
dummyMessageHandler.payloads.add(text);
@@ -367,7 +367,7 @@
break;
}
message.acknowledge();
- payloads.add(message.getBody().getString());
+ payloads.add(message.getBody().readString());
Thread.sleep(110);
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/MessageGroupingTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/MessageGroupingTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/MessageGroupingTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -116,14 +116,14 @@
int i = 0;
for (ClientMessage message : dummyMessageHandler.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
assertEquals(dummyMessageHandler2.list.size(), 50);
i = 1;
for (ClientMessage message : dummyMessageHandler2.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
consumer.close();
@@ -163,14 +163,14 @@
int i = 0;
for (ClientMessage message : dummyMessageHandler.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
assertEquals(dummyMessageHandler2.list.size(), 50);
i = 1;
for (ClientMessage message : dummyMessageHandler2.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
consumer.close();
@@ -204,11 +204,11 @@
{
ClientMessage cm = consumer.receive(500);
assertNotNull(cm);
- assertEquals(cm.getBody().getString(), "m" + i);
+ assertEquals(cm.getBody().readString(), "m" + i);
i++;
cm = consumer2.receive(500);
assertNotNull(cm);
- assertEquals(cm.getBody().getString(), "m" + i);
+ assertEquals(cm.getBody().readString(), "m" + i);
}
consumer2.close();
@@ -219,13 +219,13 @@
{
ClientMessage cm = consumer.receive(500);
assertNotNull(cm);
- assertEquals(cm.getBody().getString(), "m" + i);
+ assertEquals(cm.getBody().readString(), "m" + i);
}
for(int i = 1; i < numMessages; i+=2)
{
ClientMessage cm = consumer.receive(500);
assertNotNull(cm);
- assertEquals(cm.getBody().getString(), "m" + i);
+ assertEquals(cm.getBody().readString(), "m" + i);
}
consumer.close();
}
@@ -259,7 +259,7 @@
int i = 0;
for (ClientMessage message : dummyMessageHandler.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 1;
}
consumer.close();
@@ -301,14 +301,14 @@
int i = 0;
for (ClientMessage message : dummyMessageHandler.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
assertEquals(dummyMessageHandler2.list.size(), 50);
i = 1;
for (ClientMessage message : dummyMessageHandler2.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
consumer.close();
@@ -352,14 +352,14 @@
int i = 0;
for (ClientMessage message : dummyMessageHandler.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
assertEquals(dummyMessageHandler2.list.size(), 50);
i = 1;
for (ClientMessage message : dummyMessageHandler2.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
latch = new CountDownLatch(numMessages);
@@ -371,14 +371,14 @@
i = 0;
for (ClientMessage message : dummyMessageHandler.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
assertEquals(dummyMessageHandler2.list.size(), 50);
i = 1;
for (ClientMessage message : dummyMessageHandler2.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
consumer = this.clientSession.createConsumer(qName);
@@ -425,14 +425,14 @@
int i = 0;
for (ClientMessage message : dummyMessageHandler.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
assertEquals(dummyMessageHandler2.list.size(), 50);
i = 1;
for (ClientMessage message : dummyMessageHandler2.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
consumer.close();
@@ -480,14 +480,14 @@
int i = 0;
for (ClientMessage message : dummyMessageHandler.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
assertEquals(dummyMessageHandler2.list.size(), 50);
i = 1;
for (ClientMessage message : dummyMessageHandler2.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
latch = new CountDownLatch(numMessages);
@@ -503,14 +503,14 @@
i = 0;
for (ClientMessage message : dummyMessageHandler.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
assertEquals(dummyMessageHandler2.list.size(), 50);
i = 1;
for (ClientMessage message : dummyMessageHandler2.list)
{
- assertEquals(message.getBody().getString(), "m" + i);
+ assertEquals(message.getBody().readString(), "m" + i);
i += 2;
}
consumer = this.clientSession.createConsumer(qName);
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueRecoveryTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueRecoveryTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueRecoveryTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -87,11 +87,11 @@
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
}
public void testManyMessagesReceivedWithRollback() throws Exception
@@ -124,27 +124,27 @@
producer.send(m1);
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
producer.send(m2);
m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
producer.send(m3);
m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
producer.send(m4);
m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
producer.send(m5);
m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m5");
+ assertEquals(m.getBody().readString(), "m5");
producer.send(m6);
m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
clientSessionXa.end(xid, XAResource.TMSUCCESS);
clientSessionXa.prepare(xid);
@@ -155,7 +155,7 @@
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
m = consumer.receive(1000);
assertNull(m);
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/queue/SoloQueueTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -72,7 +72,7 @@
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
}
public void testMultipleMessages() throws Exception
@@ -97,11 +97,11 @@
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
}
public void testFirstMessageReceivedButAckedAfter() throws Exception
@@ -119,11 +119,11 @@
assertNotNull(m);
producer.send(m2);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
}
public void testFirstMessageReceivedAndCancelled() throws Exception
@@ -145,7 +145,7 @@
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = consumer.receive(1000);
assertNull(m);
}
@@ -172,33 +172,33 @@
producer.send(m1);
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
producer.send(m2);
m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
producer.send(m3);
m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
producer.send(m4);
m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
producer.send(m5);
m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m5");
+ assertEquals(m.getBody().readString(), "m5");
producer.send(m6);
m = consumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
consumer.close();
consumer = clientSession.createConsumer(qName1);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
m = consumer.receive(1000);
assertNull(m);
}
@@ -219,7 +219,7 @@
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
}
public void testMultipleMessagesInTx() throws Exception
@@ -244,11 +244,11 @@
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSessionTxReceives.commit();
m = consumer.receive(1000);
assertNull(m);
@@ -274,30 +274,30 @@
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
producer.send(m3);
producer.send(m4);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSessionTxReceives.rollback();
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
}
public void testMultipleMessagesInTxSend() throws Exception
@@ -328,7 +328,7 @@
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
}
public void testMultipleMessagesPersistedCorrectly() throws Exception
@@ -365,7 +365,7 @@
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
assertEquals(0, storageManager.messageIds.size());
}
@@ -404,7 +404,7 @@
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
assertEquals(0, storageManager.messageIds.size());
}
@@ -436,32 +436,32 @@
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
producer.send(m2);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
producer.send(m3);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
producer.send(m4);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
producer.send(m5);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m5");
+ assertEquals(m.getBody().readString(), "m5");
producer.send(m6);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
assertEquals(6, storageManager.ackIds.size());
}
@@ -493,32 +493,32 @@
ClientMessage m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
producer.send(m2);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
producer.send(m3);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
producer.send(m4);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
producer.send(m5);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m5");
+ assertEquals(m.getBody().readString(), "m5");
producer.send(m6);
m = consumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
clientSessionTxReceives.commit();
assertEquals(6, storageManager.ackIds.size());
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -156,7 +156,7 @@
ClientMessage message2 = consumer.receive(10250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m1", message2.getBody().getString());
+ assertEquals("m1", message2.getBody().readString());
message2.acknowledge();
@@ -190,8 +190,8 @@
session.start();
ClientMessage message3 = consumer.receive(1000);
ClientMessage message2 = consumer2.receive(1000);
- assertEquals("m1", message3.getBody().getString());
- assertEquals("m1", message2.getBody().getString());
+ assertEquals("m1", message3.getBody().readString());
+ assertEquals("m1", message2.getBody().readString());
long time = System.currentTimeMillis();
// force redelivery
consumer.close();
@@ -202,8 +202,8 @@
message2 = consumer2.receive(1000);
time += 5000;
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m1", message3.getBody().getString());
- assertEquals("m1", message2.getBody().getString());
+ assertEquals("m1", message3.getBody().readString());
+ assertEquals("m1", message2.getBody().readString());
message2.acknowledge();
message3.acknowledge();
@@ -241,8 +241,8 @@
assertNotNull(message3);
ClientMessage message2 = consumer2.receive(1000);
assertNotNull(message2);
- assertEquals("m1", message3.getBody().getString());
- assertEquals("m1", message2.getBody().getString());
+ assertEquals("m1", message3.getBody().readString());
+ assertEquals("m1", message2.getBody().readString());
long time = System.currentTimeMillis();
// force redelivery
consumer.close();
@@ -264,8 +264,8 @@
assertNotNull(message2);
time += 5000;
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m1", message3.getBody().getString());
- assertEquals("m1", message2.getBody().getString());
+ assertEquals("m1", message3.getBody().readString());
+ assertEquals("m1", message2.getBody().readString());
message2.acknowledge();
message3.acknowledge();
@@ -291,7 +291,7 @@
0,
System.currentTimeMillis(),
(byte)1);
- message.getBody().putString("testINVMCoreClient");
+ message.getBody().writeString("testINVMCoreClient");
message.getBody().flip();
message.setDurable(true);
long time = System.currentTimeMillis();
@@ -317,7 +317,7 @@
ClientMessage message2 = consumer.receive(11000);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("testINVMCoreClient", message2.getBody().getString());
+ assertEquals("testINVMCoreClient", message2.getBody().readString());
message2.acknowledge();
@@ -378,27 +378,27 @@
ClientMessage message = consumer.receive(11000);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m1", message.getBody().getString());
+ assertEquals("m1", message.getBody().readString());
message.acknowledge();
time += 1000;
message = consumer.receive(1250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m2", message.getBody().getString());
+ assertEquals("m2", message.getBody().readString());
message.acknowledge();
time += 1000;
message = consumer.receive(1250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m3", message.getBody().getString());
+ assertEquals("m3", message.getBody().readString());
message.acknowledge();
time += 1000;
message = consumer.receive(1250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m4", message.getBody().getString());
+ assertEquals("m4", message.getBody().readString());
message.acknowledge();
time += 1000;
message = consumer.receive(1250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m5", message.getBody().getString());
+ assertEquals("m5", message.getBody().readString());
message.acknowledge();
// Make sure no more messages
@@ -459,27 +459,27 @@
ClientMessage message = consumer.receive(10250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m1", message.getBody().getString());
+ assertEquals("m1", message.getBody().readString());
message.acknowledge();
time += 1000;
message = consumer.receive(1250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m3", message.getBody().getString());
+ assertEquals("m3", message.getBody().readString());
message.acknowledge();
time += 1000;
message = consumer.receive(1250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m5", message.getBody().getString());
+ assertEquals("m5", message.getBody().readString());
message.acknowledge();
time += 1000;
message = consumer.receive(1250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m2", message.getBody().getString());
+ assertEquals("m2", message.getBody().readString());
message.acknowledge();
time += 1000;
message = consumer.receive(1250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m4", message.getBody().getString());
+ assertEquals("m4", message.getBody().readString());
message.acknowledge();
// Make sure no more messages
@@ -534,24 +534,24 @@
session.start();
ClientMessage message = consumer.receive(1000);
- assertEquals("m2", message.getBody().getString());
+ assertEquals("m2", message.getBody().readString());
message.acknowledge();
message = consumer.receive(1000);
- assertEquals("m4", message.getBody().getString());
+ assertEquals("m4", message.getBody().readString());
message.acknowledge();
message = consumer.receive(10250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m1", message.getBody().getString());
+ assertEquals("m1", message.getBody().readString());
message.acknowledge();
time += 1000;
message = consumer.receive(1250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m3", message.getBody().getString());
+ assertEquals("m3", message.getBody().readString());
message.acknowledge();
time += 1000;
message = consumer.receive(1250);
assertTrue(System.currentTimeMillis() >= time);
- assertEquals("m5", message.getBody().getString());
+ assertEquals("m5", message.getBody().readString());
message.acknowledge();
// Make sure no more messages
@@ -578,7 +578,7 @@
0,
System.currentTimeMillis(),
(byte)1);
- message.getBody().putString("testINVMCoreClient");
+ message.getBody().writeString("testINVMCoreClient");
message.getBody().flip();
message.setDurable(true);
Calendar cal = Calendar.getInstance();
@@ -608,7 +608,7 @@
ClientMessage message2 = consumer.receive(10000);
assertTrue(System.currentTimeMillis() >= cal.getTimeInMillis());
assertNotNull(message2);
- assertEquals("testINVMCoreClient", message2.getBody().getString());
+ assertEquals("testINVMCoreClient", message2.getBody().readString());
message2.acknowledge();
session.end(xid2, XAResource.TMSUCCESS);
@@ -628,7 +628,7 @@
0,
System.currentTimeMillis(),
(byte)1);
- message.getBody().putString(body);
+ message.getBody().writeString(body);
message.getBody().flip();
message.setDurable(true);
return message;
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/security/SimpleClient.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/security/SimpleClient.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/security/SimpleClient.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -74,7 +74,7 @@
0,
System.currentTimeMillis(),
(byte)1);
- message.getBody().putString(messageText);
+ message.getBody().writeString(messageText);
producer.send(message);
session.start();
@@ -85,7 +85,7 @@
throw new Exception("did not receive the message");
}
- String text = receivedMsg.getBody().getString();
+ String text = receivedMsg.getBody().readString();
if (text == null || !text.equals(messageText))
{
throw new Exception("received " + text + ", was expecting " + messageText);
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/ssl/CoreClientOverSSL.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -76,7 +76,7 @@
ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE, false, 0,
System.currentTimeMillis(), (byte) 1);
- message.getBody().putString(CoreClientOverSSLTest.MESSAGE_TEXT_FROM_CLIENT);
+ message.getBody().writeString(CoreClientOverSSLTest.MESSAGE_TEXT_FROM_CLIENT);
producer.send(message);
session.close();
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/wildcard/WildCardRoutingTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/wildcard/WildCardRoutingTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/wildcard/WildCardRoutingTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -63,11 +63,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -88,11 +88,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -121,11 +121,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -162,11 +162,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -193,11 +193,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -222,11 +222,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -254,11 +254,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
clientConsumer.close();
clientSession.deleteQueue(queueName);
@@ -312,39 +312,39 @@
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m3", m.getBody().getString());
+ assertEquals("m3", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m4", m.getBody().getString());
+ assertEquals("m4", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m5", m.getBody().getString());
+ assertEquals("m5", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m6", m.getBody().getString());
+ assertEquals("m6", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m7", m.getBody().getString());
+ assertEquals("m7", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m8", m.getBody().getString());
+ assertEquals("m8", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m9", m.getBody().getString());
+ assertEquals("m9", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -409,39 +409,39 @@
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m3", m.getBody().getString());
+ assertEquals("m3", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m4", m.getBody().getString());
+ assertEquals("m4", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m5", m.getBody().getString());
+ assertEquals("m5", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m6", m.getBody().getString());
+ assertEquals("m6", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m7", m.getBody().getString());
+ assertEquals("m7", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m8", m.getBody().getString());
+ assertEquals("m8", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m9", m.getBody().getString());
+ assertEquals("m9", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -479,11 +479,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -508,11 +508,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -538,11 +538,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -567,11 +567,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -596,7 +596,7 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -621,11 +621,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
}
@@ -648,7 +648,7 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -673,7 +673,7 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -698,7 +698,7 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -723,7 +723,7 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -748,7 +748,7 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
@@ -776,11 +776,11 @@
producer2.send(createTextMessage("m2", clientSession));
ClientMessage m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m1", m.getBody().getString());
+ assertEquals("m1", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNotNull(m);
- assertEquals("m2", m.getBody().getString());
+ assertEquals("m2", m.getBody().readString());
m.acknowledge();
m = clientConsumer.receive(500);
assertNull(m);
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -503,16 +503,16 @@
clientSession.start();
ClientMessage m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
}
public void testBasicSendWithRollback(final boolean stopServer) throws Exception
@@ -607,16 +607,16 @@
clientSession.start();
ClientMessage m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m5");
+ assertEquals(m.getBody().readString(), "m5");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m7");
+ assertEquals(m.getBody().readString(), "m7");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m8");
+ assertEquals(m.getBody().readString(), "m8");
}
public void testMultipleTxSendWithCommit(final boolean stopServer) throws Exception
@@ -669,28 +669,28 @@
clientSession.start();
ClientMessage m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m5");
+ assertEquals(m.getBody().readString(), "m5");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m7");
+ assertEquals(m.getBody().readString(), "m7");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m8");
+ assertEquals(m.getBody().readString(), "m8");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
}
public void testMultipleTxSendWithRollback(final boolean stopServer) throws Exception
@@ -795,16 +795,16 @@
clientSession.start();
ClientMessage m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
m = clientConsumer.receive(1000);
assertNull(m);
}
@@ -858,28 +858,28 @@
clientSession.start();
ClientMessage m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m5");
+ assertEquals(m.getBody().readString(), "m5");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m7");
+ assertEquals(m.getBody().readString(), "m7");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m8");
+ assertEquals(m.getBody().readString(), "m8");
}
public void testBasicReceiveWithCommit(final boolean stopServer) throws Exception
@@ -901,19 +901,19 @@
ClientMessage m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSession.end(xid, XAResource.TMSUCCESS);
assertEquals("Expected XA_OK", XAResource.XA_OK, clientSession.prepare(xid));
@@ -959,19 +959,19 @@
ClientMessage m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSession.end(xid, XAResource.TMSUCCESS);
clientSession.prepare(xid);
@@ -1000,16 +1000,16 @@
clientSession.start();
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
}
public void testMultipleTxReceiveWithCommit(final boolean stopServer) throws Exception
@@ -1045,19 +1045,19 @@
ClientMessage m = clientConsumer2.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m5");
+ assertEquals(m.getBody().readString(), "m5");
m = clientConsumer2.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
m = clientConsumer2.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m7");
+ assertEquals(m.getBody().readString(), "m7");
m = clientConsumer2.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m8");
+ assertEquals(m.getBody().readString(), "m8");
clientSession2.end(xid2, XAResource.TMSUCCESS);
clientSession2.prepare(xid2);
clientSession2.close();
@@ -1067,19 +1067,19 @@
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSession.end(xid, XAResource.TMSUCCESS);
clientSession.prepare(xid);
@@ -1135,19 +1135,19 @@
ClientMessage m = clientConsumer2.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m5");
+ assertEquals(m.getBody().readString(), "m5");
m = clientConsumer2.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
m = clientConsumer2.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m7");
+ assertEquals(m.getBody().readString(), "m7");
m = clientConsumer2.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m8");
+ assertEquals(m.getBody().readString(), "m8");
clientSession2.end(xid2, XAResource.TMSUCCESS);
clientSession2.prepare(xid2);
clientSession2.close();
@@ -1157,19 +1157,19 @@
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSession.end(xid, XAResource.TMSUCCESS);
clientSession.prepare(xid);
@@ -1191,19 +1191,19 @@
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
}
protected void stopAndRestartServer() throws Exception
@@ -1246,7 +1246,7 @@
0,
System.currentTimeMillis(),
(byte)1);
- message.getBody().putString(s);
+ message.getBody().writeString(s);
message.getBody().flip();
return message;
}
@@ -1258,7 +1258,7 @@
0,
System.currentTimeMillis(),
(byte)1);
- message.getBody().putBytes(b);
+ message.getBody().writeBytes(b);
message.getBody().flip();
return message;
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -138,16 +138,16 @@
ClientConsumer clientConsumer = clientSession.createConsumer(atestq);
ClientMessage m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
}
public void testReceivePrepareDoesntRollbackOnClose() throws Exception
@@ -172,19 +172,19 @@
ClientMessage m = clientConsumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(1000);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSession.end(xid, XAResource.TMSUCCESS);
clientSession.prepare(xid);
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -164,19 +164,19 @@
ClientMessage m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(500);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSession.end(xid, XAResource.TMSUCCESS);
Thread.sleep(2600);
try
@@ -195,19 +195,19 @@
m = consumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = consumer.receive(500);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = consumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = consumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSession2.close();
}
@@ -240,19 +240,19 @@
ClientMessage m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(500);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSession.end(xid, XAResource.TMSUCCESS);
Thread.sleep(2600);
try
@@ -271,19 +271,19 @@
m = consumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = consumer.receive(500);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = consumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = consumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
m = consumer.receive(500);
assertNull(m);
clientSession2.close();
@@ -318,19 +318,19 @@
ClientMessage m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = clientConsumer.receive(500);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = clientConsumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSession.end(xid, XAResource.TMSUCCESS);
clientSession.prepare(xid);
Thread.sleep(2600);
@@ -344,19 +344,19 @@
m = consumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m5");
+ assertEquals(m.getBody().readString(), "m5");
m = consumer.receive(500);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m6");
+ assertEquals(m.getBody().readString(), "m6");
m = consumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m7");
+ assertEquals(m.getBody().readString(), "m7");
m = consumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m8");
+ assertEquals(m.getBody().readString(), "m8");
m = consumer.receive(500);
assertNull(m);
clientSession2.close();
@@ -416,19 +416,19 @@
clientSession2.start();
ClientMessage m = consumer.receive(500);
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m1");
+ assertEquals(m.getBody().readString(), "m1");
m = consumer.receive(500);
assertNotNull(m);
m.acknowledge();
- assertEquals(m.getBody().getString(), "m2");
+ assertEquals(m.getBody().readString(), "m2");
m = consumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m3");
+ assertEquals(m.getBody().readString(), "m3");
m = consumer.receive(500);
m.acknowledge();
assertNotNull(m);
- assertEquals(m.getBody().getString(), "m4");
+ assertEquals(m.getBody().readString(), "m4");
clientSession2.close();
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/performance/persistence/StorageManagerTimingTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -143,7 +143,7 @@
}
final IoBufferWrapper buffer = new IoBufferWrapper(1024);
- buffer.putBytes(bytes);
+ buffer.writeBytes(bytes);
final AtomicLong transactionGenerator = new AtomicLong(1);
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -69,7 +69,7 @@
}
buffer.rewind();
- buffer.putUTF(str);
+ buffer.writeUTF(str);
}
long spentTime = System.currentTimeMillis() - start;
@@ -82,7 +82,7 @@
{
ChannelBufferWrapper buffer = new ChannelBufferWrapper(10 * 1024);
- buffer.putUTF(str);
+ buffer.writeUTF(str);
long start = System.currentTimeMillis();
@@ -96,7 +96,7 @@
}
buffer.rewind();
- String newstr = buffer.getUTF();
+ String newstr = buffer.readUTF();
assertEquals(str, newstr);
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/SimpleEncoding.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/SimpleEncoding.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/SimpleEncoding.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -61,7 +61,7 @@
{
for (int i = 0; i < size; i++)
{
- buffer.putByte(bytetosend);
+ buffer.writeByte(bytetosend);
}
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/message/impl/MessageImplTestBase.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -164,7 +164,7 @@
{
byte[] bytes = new byte[]{(byte)1, (byte)2, (byte)3};
final IoBufferWrapper bufferBody = new IoBufferWrapper(bytes.length);
- bufferBody.putBytes(bytes);
+ bufferBody.writeBytes(bytes);
SimpleString address = new SimpleString("Simple Destination ");
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreTestBase.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreTestBase.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/paging/impl/PagingStoreTestBase.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -241,7 +241,7 @@
for (PagedMessage msg : msgs)
{
msg.getMessage(null).getBody().rewind();
- long id = msg.getMessage(null).getBody().getLong();
+ long id = msg.getMessage(null).getBody().readLong();
msg.getMessage(null).getBody().rewind();
PagedMessageImpl msgWritten = buffers.remove(id);
@@ -314,7 +314,7 @@
{
msg.getMessage(null).getBody().rewind();
- long id = msg.getMessage(null).getBody().getLong();
+ long id = msg.getMessage(null).getBody().readLong();
PagedMessage msgWritten = buffers2.remove(id);
assertNotNull(msgWritten);
assertEquals(msg.getMessage(null).getDestination(), msgWritten.getMessage(null).getDestination());
@@ -330,7 +330,7 @@
assertEquals(1, lastMessages.size());
lastMessages.get(0).getMessage(null).getBody().rewind();
- assertEquals(lastMessages.get(0).getMessage(null).getBody().getLong(), lastMessageId);
+ assertEquals(lastMessages.get(0).getMessage(null).getBody().readLong(), lastMessageId);
assertEqualsByteArrays(lastMessages.get(0).getMessage(null).getBody().array(), lastMsg.getMessage(null)
.getBody()
.array());
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/remoting/MessagingBufferTestBase.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/remoting/MessagingBufferTestBase.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/remoting/MessagingBufferTestBase.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -122,30 +122,30 @@
public void testByte() throws Exception
{
byte b = randomByte();
- wrapper.putByte(b);
+ wrapper.writeByte(b);
wrapper.flip();
- assertEquals(b, wrapper.getByte());
+ assertEquals(b, wrapper.readByte());
}
public void testUnsignedByte() throws Exception
{
byte b = (byte) 0xff;
- wrapper.putByte(b);
+ wrapper.writeByte(b);
wrapper.flip();
- assertEquals(255, wrapper.getUnsignedByte());
+ assertEquals(255, wrapper.readUnsignedByte());
wrapper.rewind();
b = (byte) 0xf;
- wrapper.putByte(b);
+ wrapper.writeByte(b);
wrapper.flip();
- assertEquals(b, wrapper.getUnsignedByte());
+ assertEquals(b, wrapper.readUnsignedByte());
}
@@ -153,12 +153,12 @@
public void testBytes() throws Exception
{
byte[] bytes = randomBytes();
- wrapper.putBytes(bytes);
+ wrapper.writeBytes(bytes);
wrapper.flip();
byte[] b = new byte[bytes.length];
- wrapper.getBytes(b);
+ wrapper.readBytes(b);
assertEqualsByteArrays(bytes, b);
}
@@ -166,50 +166,50 @@
{
byte[] bytes = randomBytes();
// put only half of the bytes
- wrapper.putBytes(bytes, 0, bytes.length / 2);
+ wrapper.writeBytes(bytes, 0, bytes.length / 2);
wrapper.flip();
byte[] b = new byte[bytes.length / 2];
- wrapper.getBytes(b, 0, b.length);
+ wrapper.readBytes(b, 0, b.length);
assertEqualsByteArrays(b.length, bytes, b);
}
public void testPutTrueBoolean() throws Exception
{
- wrapper.putBoolean(true);
+ wrapper.writeBoolean(true);
wrapper.flip();
- assertTrue(wrapper.getBoolean());
+ assertTrue(wrapper.readBoolean());
}
public void testPutFalseBoolean() throws Exception
{
- wrapper.putBoolean(false);
+ wrapper.writeBoolean(false);
wrapper.flip();
- assertFalse(wrapper.getBoolean());
+ assertFalse(wrapper.readBoolean());
}
public void testChar() throws Exception
{
- wrapper.putChar('a');
+ wrapper.writeChar('a');
wrapper.flip();
- assertEquals('a', wrapper.getChar());
+ assertEquals('a', wrapper.readChar());
}
public void testInt() throws Exception
{
int i = randomInt();
- wrapper.putInt(i);
+ wrapper.writeInt(i);
wrapper.flip();
- assertEquals(i, wrapper.getInt());
+ assertEquals(i, wrapper.readInt());
}
public void testIntAtPosition() throws Exception
@@ -217,36 +217,36 @@
int firstInt = randomInt();
int secondInt = randomInt();
- wrapper.putInt(secondInt);
- wrapper.putInt(secondInt);
+ wrapper.writeInt(secondInt);
+ wrapper.writeInt(secondInt);
// rewrite firstInt at the beginning
- wrapper.putInt(0, firstInt);
+ wrapper.setInt(0, firstInt);
wrapper.flip();
- assertEquals(firstInt, wrapper.getInt());
- assertEquals(secondInt, wrapper.getInt());
+ assertEquals(firstInt, wrapper.readInt());
+ assertEquals(secondInt, wrapper.readInt());
}
public void testLong() throws Exception
{
long l = randomLong();
- wrapper.putLong(l);
+ wrapper.writeLong(l);
wrapper.flip();
- assertEquals(l, wrapper.getLong());
+ assertEquals(l, wrapper.readLong());
}
public void testUnsignedShort() throws Exception
{
short s1 = Short.MAX_VALUE;
- wrapper.putShort(s1);
+ wrapper.writeShort(s1);
wrapper.flip();
- int s2 = wrapper.getUnsignedShort();
+ int s2 = wrapper.readUnsignedShort();
assertEquals(s1, s2);
@@ -254,11 +254,11 @@
s1 = Short.MIN_VALUE;
- wrapper.putShort(s1);
+ wrapper.writeShort(s1);
wrapper.flip();
- s2 = wrapper.getUnsignedShort();
+ s2 = wrapper.readUnsignedShort();
assertEquals(s1 * -1, s2);
@@ -266,11 +266,11 @@
s1 = -1;
- wrapper.putShort(s1);
+ wrapper.writeShort(s1);
wrapper.flip();
- s2 = wrapper.getUnsignedShort();
+ s2 = wrapper.readUnsignedShort();
// / The max of an unsigned short
// (http://en.wikipedia.org/wiki/Unsigned_short)
@@ -279,47 +279,47 @@
public void testShort() throws Exception
{
- wrapper.putShort((short) 1);
+ wrapper.writeShort((short) 1);
wrapper.flip();
- assertEquals((short)1, wrapper.getShort());
+ assertEquals((short)1, wrapper.readShort());
}
public void testDouble() throws Exception
{
double d = randomDouble();
- wrapper.putDouble(d);
+ wrapper.writeDouble(d);
wrapper.flip();
- assertEquals(d, wrapper.getDouble());
+ assertEquals(d, wrapper.readDouble());
}
public void testFloat() throws Exception
{
float f = randomFloat();
- wrapper.putFloat(f);
+ wrapper.writeFloat(f);
wrapper.flip();
- assertEquals(f, wrapper.getFloat());
+ assertEquals(f, wrapper.readFloat());
}
public void testUTF() throws Exception
{
String str = randomString();
- wrapper.putUTF(str);
+ wrapper.writeUTF(str);
wrapper.flip();
- assertEquals(str, wrapper.getUTF());
+ assertEquals(str, wrapper.readUTF());
}
public void testArray() throws Exception
{
byte[] bytes = randomBytes(128);
- wrapper.putBytes(bytes);
+ wrapper.writeBytes(bytes);
wrapper.flip();
@@ -331,15 +331,15 @@
public void testRewind() throws Exception
{
int i = randomInt();
- wrapper.putInt(i);
+ wrapper.writeInt(i);
wrapper.flip();
- assertEquals(i, wrapper.getInt());
+ assertEquals(i, wrapper.readInt());
wrapper.rewind();
- assertEquals(i, wrapper.getInt());
+ assertEquals(i, wrapper.readInt());
}
public void testRemaining() throws Exception
@@ -350,7 +350,7 @@
// fill 1/3 of the buffer
int fill = capacity / 3;
byte[] bytes = randomBytes(fill);
- wrapper.putBytes(bytes);
+ wrapper.writeBytes(bytes);
// check the remaining is 2/3
assertEquals(capacity - fill, wrapper.remaining());
@@ -361,7 +361,7 @@
assertEquals(0, wrapper.position());
byte[] bytes = randomBytes(128);
- wrapper.putBytes(bytes);
+ wrapper.writeBytes(bytes);
assertEquals(bytes.length, wrapper.position());
@@ -374,7 +374,7 @@
assertEquals(wrapper.capacity(), wrapper.limit());
byte[] bytes = randomBytes(128);
- wrapper.putBytes(bytes);
+ wrapper.writeBytes(bytes);
assertTrue(wrapper.limit() >= bytes.length);
@@ -385,7 +385,7 @@
public void testSlice() throws Exception
{
byte[] bytes = randomBytes(128);
- wrapper.putBytes(bytes);
+ wrapper.writeBytes(bytes);
wrapper.position(0);
wrapper.limit(128);
@@ -394,7 +394,7 @@
assertEquals(128, slicedBuffer.capacity());
byte[] slicedBytes = new byte[128];
- slicedBuffer.getBytes(slicedBytes);
+ slicedBuffer.readBytes(slicedBytes);
assertEqualsByteArrays(bytes, slicedBytes);
}
@@ -407,20 +407,20 @@
private String putAndGetNullableString(String nullableString) throws Exception
{
- wrapper.putNullableString(nullableString);
+ wrapper.writeNullableString(nullableString);
wrapper.flip();
- return wrapper.getNullableString();
+ return wrapper.readNullableString();
}
private SimpleString putAndGetNullableSimpleString(SimpleString nullableSimpleString) throws Exception
{
- wrapper.putNullableSimpleString(nullableSimpleString);
+ wrapper.writeNullableSimpleString(nullableSimpleString);
wrapper.flip();
- return wrapper.getNullableSimpleString();
+ return wrapper.readNullableSimpleString();
}
// Inner classes -------------------------------------------------
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -113,7 +113,7 @@
final int size = 1234;
MessagingBuffer buff = conn.createBuffer(size);
- buff.putByte((byte) 0x00); // Netty buffer does lazy initialization.
+ buff.writeByte((byte) 0x00); // Netty buffer does lazy initialization.
assertEquals(size, buff.capacity());
EasyMock.verify(channel);
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -127,7 +127,7 @@
JBossBytesMessage message = new JBossBytesMessage();
MessagingBuffer body = message.getCoreMessage().getBody();
- body.putBoolean(value);
+ body.writeBoolean(value);
message.reset();
assertEquals(value, message.readBoolean());
@@ -161,7 +161,7 @@
JBossBytesMessage message = new JBossBytesMessage();
MessagingBuffer body = message.getCoreMessage().getBody();
- body.putByte(value);
+ body.writeByte(value);
message.reset();
assertEquals(value, message.readByte());
@@ -197,7 +197,7 @@
JBossBytesMessage message = new JBossBytesMessage();
MessagingBuffer body = message.getCoreMessage().getBody();
- body.putBytes(value);
+ body.writeBytes(value);
message.reset();
byte[] v = new byte[value.length];
@@ -232,7 +232,7 @@
JBossBytesMessage message = new JBossBytesMessage();
MessagingBuffer body = message.getCoreMessage().getBody();
- body.putShort(value);
+ body.writeShort(value);
message.reset();
assertEquals(value, message.readShort());
@@ -266,7 +266,7 @@
JBossBytesMessage message = new JBossBytesMessage();
MessagingBuffer body = message.getCoreMessage().getBody();
- body.putChar(value);
+ body.writeChar(value);
message.reset();
assertEquals(value, message.readChar());
@@ -300,7 +300,7 @@
JBossBytesMessage message = new JBossBytesMessage();
MessagingBuffer body = message.getCoreMessage().getBody();
- body.putInt(value);
+ body.writeInt(value);
message.reset();
assertEquals(value, message.readInt());
@@ -334,7 +334,7 @@
JBossBytesMessage message = new JBossBytesMessage();
MessagingBuffer body = message.getCoreMessage().getBody();
- body.putLong(value);
+ body.writeLong(value);
message.reset();
assertEquals(value, message.readLong());
@@ -368,7 +368,7 @@
JBossBytesMessage message = new JBossBytesMessage();
MessagingBuffer body = message.getCoreMessage().getBody();
- body.putFloat(value);
+ body.writeFloat(value);
message.reset();
assertEquals(value, message.readFloat());
@@ -402,7 +402,7 @@
JBossBytesMessage message = new JBossBytesMessage();
MessagingBuffer body = message.getCoreMessage().getBody();
- body.putDouble(value);
+ body.writeDouble(value);
message.reset();
assertEquals(value, message.readDouble());
@@ -436,7 +436,7 @@
JBossBytesMessage message = new JBossBytesMessage();
MessagingBuffer body = message.getCoreMessage().getBody();
- body.putUTF(value);
+ body.writeUTF(value);
message.reset();
assertEquals(value, message.readUTF());
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -130,9 +130,9 @@
msg.doBeforeSend();
MessagingBuffer body = msg.getCoreMessage().getBody();
- assertEquals(data.length, body.getInt());
+ assertEquals(data.length, body.readInt());
byte[] bytes = new byte[data.length];
- body.getBytes(bytes);
+ body.readBytes(bytes);
assertEqualsByteArrays(data, bytes);
}
@@ -147,8 +147,8 @@
JBossObjectMessage message = new JBossObjectMessage();
MessagingBuffer body = message.getCoreMessage().getBody();
- body.putInt(data.length);
- body.putBytes(data);
+ body.writeInt(data.length);
+ body.writeBytes(data);
body.flip();
message.doBeforeReceive();
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -120,7 +120,7 @@
msg.doBeforeSend();
MessagingBuffer body = msg.getCoreMessage().getBody();
- String s = body.getNullableString();
+ String s = body.readNullableString();
assertEquals(text, s);
}
@@ -129,7 +129,7 @@
JBossTextMessage msg = new JBossTextMessage();
assertNull(msg.getText());
MessagingBuffer body = msg.getCoreMessage().getBody();
- body.putNullableString(text);
+ body.writeNullableString(text);
body.flip();
msg.doBeforeReceive();
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -253,7 +253,7 @@
public String getTextMessage(ClientMessage m)
{
m.getBody().rewind();
- return m.getBody().getString();
+ return m.getBody().readString();
}
protected ClientMessage createTextMessage(final ClientSession session, final String s, final boolean durable)
@@ -263,7 +263,7 @@
0,
System.currentTimeMillis(),
(byte)1);
- message.getBody().putString(s);
+ message.getBody().writeString(s);
message.getBody().flip();
return message;
}
@@ -275,7 +275,7 @@
0,
System.currentTimeMillis(),
(byte)1);
- message.getBody().putBytes(b);
+ message.getBody().writeBytes(b);
message.getBody().flip();
return message;
}
Modified: branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
===================================================================
--- branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java 2009-02-25 01:17:30 UTC (rev 5923)
+++ branches/JBMESSAGING_1394/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java 2009-02-25 02:48:17 UTC (rev 5924)
@@ -608,7 +608,7 @@
// message.setPayload(bytes);
- message.getBody().putString(UUID.randomUUID().toString());
+ message.getBody().writeString(UUID.randomUUID().toString());
message.setDestination(new SimpleString("foo"));
@@ -639,7 +639,7 @@
0,
System.currentTimeMillis(),
(byte)1);
- message.getBody().putString(s);
+ message.getBody().writeString(s);
message.getBody().flip();
return message;
}
More information about the jboss-cvs-commits
mailing list