Package java.io

Examples of java.io.DataInputStream.available()


      oos.reset();
      oos.writeByte(24);
      oos.close();

      DataInputStream dis = new DataInputStream(loadStream());
      byte[] input = new byte[dis.available()];
      dis.readFully(input);
      byte[] result = new byte[] { (byte) 0xac, (byte) 0xed, (byte) 0,
          (byte) 5, (byte) 0x79, (byte) 0x74, (byte) 0, (byte) 1,
          (byte) 'R', (byte) 0x79, (byte) 0x77, (byte) 1, (byte) 24 };
      assertTrue("incorrect output", Arrays.equals(input, result));
View Full Code Here


      oos.reset();
      oos.writeByte(24);
      oos.close();

      DataInputStream dis = new DataInputStream(loadStream());
      byte[] input = new byte[dis.available()];
      dis.readFully(input);
      byte[] result = new byte[] { (byte) 0xac, (byte) 0xed, (byte) 0,
          (byte) 5, (byte) 0x79, (byte) 0x74, (byte) 0, (byte) 1,
          (byte) 'R', (byte) 0x79, (byte) 0x77, (byte) 1, (byte) 24 };
      assertTrue("incorrect output", Arrays.equals(input, result));
View Full Code Here

            }
    
            // last record
         
            dis.reset();
      len = (int) dis.available() - recOffset[lastIndex];
      dis.skip(recOffset[lastIndex]);    
      bytes = new byte[len];
            dis.readFully(bytes);
            recArray[lastIndex] = new Record(bytes, recAttrs[lastIndex]);
        }
View Full Code Here

            }
    
            // last record
         
            dis.reset();
      len = (int) dis.available() - recOffset[lastIndex];
      dis.skip(recOffset[lastIndex]);    
      bytes = new byte[len];
            dis.readFully(bytes);
            recArray[lastIndex] = new Record(bytes, recAttrs[lastIndex]);
        }
View Full Code Here

                case Leader.PING:
                    // Process the touches
                    ByteArrayInputStream bis = new ByteArrayInputStream(qp
                            .getData());
                    DataInputStream dis = new DataInputStream(bis);
                    while (dis.available() > 0) {
                        long sess = dis.readLong();
                        int to = dis.readInt();
                        leader.zk.touch(sess, to);
                    }
                    break;
View Full Code Here

        Util.debug("Fully-qualified Filename: " + fileName);
        File imgFile = new File(fileName);
        // Open the input file as a stream of bytes
        FileInputStream fis = new FileInputStream(imgFile);
        DataInputStream dis = new DataInputStream(fis);
        int dataSize = dis.available();
        byte[] data = new byte[dataSize];
        dis.readFully(data);
        catalog.setItemImageBytes(itemID, data);
    }
    /**
 
View Full Code Here

                    ByteArrayInputStream in = new ByteArrayInputStream( buffer );
                    DataInputStream readIn = new DataInputStream( in );

                    do
                    {
                        if ( readIn.available() > 1 )
                        {
                            int size = readIn.readInt();
                            byte[] connectionId = new byte[size];
                            readIn.read( connectionId );
                            connection = BrowserCorePlugin.getDefault().getConnectionManager()
View Full Code Here

                            connection = BrowserCorePlugin.getDefault().getConnectionManager()
                                .getBrowserConnectionById( new String( connectionId, "UTF-8" ) ); //$NON-NLS-1$
                        }

                        IEntry entry = null;
                        if ( readIn.available() > 1 && connection != null )
                        {
                            int size = readIn.readInt();
                            byte[] dn = new byte[size];
                            readIn.read( dn );
                            entry = connection.getEntryFromCache( new LdapDN( new String( dn, "UTF-8" ) ) ); //$NON-NLS-1$
View Full Code Here

                        if ( entry != null )
                        {
                            entryList.add( entry );
                        }
                    }
                    while ( readIn.available() > 1 );

                    readIn.close();
                }
                catch ( IOException ex )
                {
View Full Code Here

                    DataInputStream readIn = new DataInputStream( in );

                    do
                    {
                        IBrowserConnection connection = null;
                        if ( readIn.available() > 1 )
                        {
                            int size = readIn.readInt();
                            byte[] connectionId = new byte[size];
                            readIn.read( connectionId );
                            connection = BrowserCorePlugin.getDefault().getConnectionManager()
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.