Package org.hornetq.utils

Examples of org.hornetq.utils.HornetQBufferInputStream


   }

   public void testReadIntegersOverStream() throws Exception
   {
      LargeMessageControllerImpl buffer = createBufferWithIntegers(3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
      HornetQBufferInputStream is = new HornetQBufferInputStream(buffer);
      DataInputStream dataInput = new DataInputStream(is);

      for (int i = 1; i <= 15; i++)
      {
         Assert.assertEquals(i, dataInput.readInt());
View Full Code Here


   }

   public void testReadLongsOverStream() throws Exception
   {
      LargeMessageControllerImpl buffer = createBufferWithLongs(3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
      HornetQBufferInputStream is = new HornetQBufferInputStream(buffer);
      DataInputStream dataInput = new DataInputStream(is);

      for (int i = 1; i <= 15; i++)
      {
         Assert.assertEquals(i, dataInput.readLong());
View Full Code Here

         byteArray[i] = getSamplebyte(i);
      }

      HornetQBuffer splitbuffer = splitBuffer(3, byteArray);

      HornetQBufferInputStream is = new HornetQBufferInputStream(splitbuffer);

      for (int i = 0; i < 100; i++)
      {
         assertEquals(getSamplebyte(i), (byte)is.read());
      }

      for (int i = 100; i < byteArray.length; i += 10)
      {
         byte readBytes[] = new byte[10];
        
         int size = is.read(readBytes);
        
         for (int j = 0; j < size; j++)
         {
            assertEquals(getSamplebyte(i + j), readBytes[j]);
         }
View Full Code Here

   {
      if (dataInput == null)
      {
         try
         {
            InputStream input = new HornetQBufferInputStream(bufferDelegate);

            dataInput = new DataInputStream(new InflaterReader(input));
         }
         catch (Exception e)
         {
View Full Code Here

   private void largeMessageSendBuffered(final boolean sendBlocking,
                                         final MessageInternal msgI,
                                         final ClientProducerCredits credits) throws HornetQException
   {
      msgI.getBodyBuffer().readerIndex(0);
      largeMessageSendStreamed(sendBlocking, msgI, new HornetQBufferInputStream(msgI.getBodyBuffer()), credits);
   }
View Full Code Here

      {
         bytes[i] = getSamplebyte(i);
      }

      HornetQBuffer buffer = HornetQBuffers.wrappedBuffer(bytes);
      HornetQBufferInputStream is = new HornetQBufferInputStream(buffer);

      // First read byte per byte
      for (int i = 0 ; i < 1024; i++)
      {
         assertEquals(getSamplebyte(i), is.read());
      }

      // Second, read in chunks
      for (int i = 1; i < 10; i++)
      {
         bytes = new byte[1024];
         is.read(bytes);
         for (int j = 0 ; j < bytes.length; j++)
         {
            assertEquals(getSamplebyte(i * 1024 + j), bytes[j]);
         }

      }

      assertEquals(-1, is.read());


      bytes = new byte[1024];

      int sizeRead = is.read(bytes);

      assertEquals(-1, sizeRead);

   }
View Full Code Here

   {
      if (dataInput == null)
      {
         try
         {
            InputStream input = new HornetQBufferInputStream(bufferDelegate);

            dataInput = new DataInputStream(new InflaterReader(input));
         }
         catch (Exception e)
         {
View Full Code Here

   private void largeMessageSendBuffered(final boolean sendBlocking,
                                         final MessageInternal msgI,
                                         final ClientProducerCredits credits) throws HornetQException
   {
      msgI.getBodyBuffer().readerIndex(0);
      largeMessageSendStreamed(sendBlocking, msgI, new HornetQBufferInputStream(msgI.getBodyBuffer()), credits);
   }
View Full Code Here

   {
      if (dataInput == null)
      {
         try
         {
            InputStream input = new HornetQBufferInputStream(bufferDelegate);

            dataInput = new DataInputStream(new InflaterReader(input));
         }
         catch (Exception e)
         {
View Full Code Here

            largeMessageSendBuffered(final boolean sendBlocking, final MessageInternal msgI,
                                     final ClientProducerCredits credits, SendAcknowledgementHandler handler)
                                                                                                              throws HornetQException
   {
      msgI.getBodyBuffer().readerIndex(0);
      largeMessageSendStreamed(sendBlocking, msgI, new HornetQBufferInputStream(msgI.getBodyBuffer()), credits,
                               handler);
   }
View Full Code Here

TOP

Related Classes of org.hornetq.utils.HornetQBufferInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.