Package org.jboss.remoting.transport.multiplex.utility

Examples of org.jboss.remoting.transport.multiplex.utility.ShrinkableByteArrayOutputStream


         final GrowablePipedInputStream  gpis2 = new GrowablePipedInputStream(vs);
         final GrowablePipedOutputStream gpos2 = new GrowablePipedOutputStream(gpis2);
         final int size =  128 * 1024;
         final byte[] bytesOut1 = new byte[size];
         final byte[] bytesOut2 = new byte[size];
         final ShrinkableByteArrayOutputStream bytesIn1  = new ShrinkableByteArrayOutputStream();
         final ShrinkableByteArrayOutputStream bytesIn2  = new ShrinkableByteArrayOutputStream();
        
         for (int i = 0; i < size; i++)
         {
            bytesOut1[i] = (byte) i;
            bytesOut2[i] = (byte) (i+1);
         }
        
         vs.register(gpis1, new Integer(1));
         vs.register(gpis2, new Integer(2));
        
         class ThreadIn extends Thread
         {
            Exception e;
           
            public void run()
            {
               Map readyMap;
               log.info("starting run()");
               try
               {
                  while ((readyMap = vs.select()) != null)
                  {
                     log.debug("readyMap != null");
                     Iterator it = readyMap.keySet().iterator();
                     while (it.hasNext())
                     {
                        InputStream is = (InputStream) it.next();
                       
                        if (is.available() == 0)
                        {
                           it.remove();
                           continue;
                        }
                       
                        Integer attachment = (Integer) readyMap.get(is);
                       
                        ShrinkableByteArrayOutputStream bytesIn;
                        if (attachment.intValue() == 1)
                           bytesIn = bytesIn1;
                        else
                           bytesIn = bytesIn2;
                        try
                        {
                           int available = is.available();
                           log.debug("available: " + available);
                           log.debug("stream: " + attachment);
                           for (int i = 0; i < available; i++)
                              bytesIn.write((byte) is.read());
                        }
                        catch (IOException e)
                        {
                           this.e = e;
                        }
View Full Code Here


                           continue;
                        }
                       
                        Integer attachment = (Integer) readyMap.get(is);
                       
                        ShrinkableByteArrayOutputStream bytesIn;
                        if (attachment.intValue() == 1)
                           bytesIn = bytesIn1;
                        else
                           bytesIn = bytesIn2;
                        try
                        {
                           int available = is.available();
                           log.debug("available: " + available);
                           log.debug("stream: " + attachment);
                           for (int i = 0; i < available; i++)
                              bytesIn.write((byte) is.read());
                        }
                        catch (IOException e)
                        {
                           this.e = e;
                        }
View Full Code Here

         final GrowablePipedInputStream  gpis2 = new GrowablePipedInputStream(vs);
         final GrowablePipedOutputStream gpos2 = new GrowablePipedOutputStream(gpis2);
         final int size =  128 * 1024;
         final byte[] bytesOut1 = new byte[size];
         final byte[] bytesOut2 = new byte[size];
         final ShrinkableByteArrayOutputStream bytesIn1  = new ShrinkableByteArrayOutputStream();
         final ShrinkableByteArrayOutputStream bytesIn2  = new ShrinkableByteArrayOutputStream();
        
         for (int i = 0; i < size; i++)
         {
            bytesOut1[i] = (byte) i;
            bytesOut2[i] = (byte) (i+1);
         }
        
         vs.register(gpis1, new Integer(1));
         vs.register(gpis2, new Integer(2));
        
         class ThreadIn extends Thread
         {
            Exception e;
           
            public void run()
            {
               Map readyMap;
               log.info("starting run()");
               try
               {
                  while ((readyMap = vs.select()) != null)
                  {
                     log.debug("readyMap != null");
                     Iterator it = readyMap.keySet().iterator();
                     while (it.hasNext())
                     {
                        InputStream is = (InputStream) it.next();
                       
                        if (is.available() == 0)
                        {
                           it.remove();
                           continue;
                        }
                       
                        Integer attachment = (Integer) readyMap.get(is);
                       
                        ShrinkableByteArrayOutputStream bytesIn;
                        if (attachment.intValue() == 1)
                           bytesIn = bytesIn1;
                        else
                           bytesIn = bytesIn2;
                        try
                        {
                           int available = is.available();
                           log.debug("available: " + available);
                           log.debug("stream: " + attachment);
                           for (int i = 0; i < available; i++)
                              bytesIn.write((byte) is.read());
                        }
                        catch (IOException e)
                        {
                           this.e = e;
                        }
View Full Code Here

                           continue;
                        }
                       
                        Integer attachment = (Integer) readyMap.get(is);
                       
                        ShrinkableByteArrayOutputStream bytesIn;
                        if (attachment.intValue() == 1)
                           bytesIn = bytesIn1;
                        else
                           bytesIn = bytesIn2;
                        try
                        {
                           int available = is.available();
                           log.debug("available: " + available);
                           log.debug("stream: " + attachment);
                           for (int i = 0; i < available; i++)
                              bytesIn.write((byte) is.read());
                        }
                        catch (IOException e)
                        {
                           this.e = e;
                        }
View Full Code Here

TOP

Related Classes of org.jboss.remoting.transport.multiplex.utility.ShrinkableByteArrayOutputStream

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.