Examples of available()


Examples of java.io.ObjectInput.available()

      ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
      ObjectInput oi = marshaller.startObjectInput(bin, false);
      MarshalledValue recreated = (MarshalledValue) marshaller.objectFromObjectStream(oi);

      // there should be nothing more
      assert oi.available() == 0;
      marshaller.finishObjectInput(oi);
      bin.close();

      assertSerialized(recreated);
      assert recreated.equals(mv);
View Full Code Here

Examples of java.io.ObjectInputStream.available()

      assert in.read() == CacheMarshaller200.MAGICNUMBER_MARSHALLEDVALUE;
      MarshalledValue recreated = new MarshalledValue();
      recreated.readExternal(in);

      // there should be nothing more
      assert in.available() == 0;
      in.close();
      bin.close();

      assertSerialized(recreated);
      assert recreated.equals(mv);
View Full Code Here

Examples of java.io.PipedInputStream.available()

        os.flush();

        Thread.sleep(1000);
        byte buffer[] = new byte[5];

        if(pi.available() == 5)
        {
            pi.read(buffer);
            if(equalBytes(buffer, expected1))
                test1spy_ok = true;
        }
View Full Code Here

Examples of java.io.PushbackInputStream.available()

            byte[] boundary = ("--" + cType.getParameter("boundary")).getBytes();
            InputStream is = new BufferedInputStream(ds.getInputStream());
            PushbackInputStream pushbackInStream = new PushbackInputStream(is,
                    (boundary.length + 2));
            readTillFirstBoundary(pushbackInStream, boundary);
            while (pushbackInStream.available()>0){
                MimeBodyPartInputStream partStream;
                partStream = new MimeBodyPartInputStream(pushbackInStream,
                        boundary);
                addBodyPart(new MimeBodyPart(partStream));
            }
View Full Code Here

Examples of java.io.StringBufferInputStream.available()

                }
            }

            ZipEntry zipEntryMF = new ZipEntry("META-INF/MANIFEST.MF");
            manifestStream = new StringBufferInputStream(manifest.toString().replace('\\','/'));
            zipEntryMF.setSize(manifestStream.available());
            zipEntryMF.setCrc(new CRC32().getValue());
            addEntry(zipEntryMF, manifestStream, zipFile);

      Enumeration filesForZipEnum=filesForZip.elements();
            while (filesForZipEnum.hasMoreElements()) {
View Full Code Here

Examples of java.security.DigestInputStream.available()

        new DigestInputStream(new FileInputStream(jarFile), md);

      // read everything, this way the message-digest
      // is calculated
      byte[] readBuffer = new byte[1024];
      while (in.available() > 0)
      {
        in.read(readBuffer);
      }

      md = in.getMessageDigest();
View Full Code Here

Examples of java.util.jar.JarInputStream.available()

    JarInputStream jis = new JarInputStream(url.openStream());
    Set result = new LinkedHashSet(8);

    // parse the jar and do pattern matching
    try {
      while (jis.available() > 0) {
        JarEntry jarEntry = jis.getNextJarEntry();
        // if the jar has ended, the entry can be null (on Sun JDK at least)
        if (jarEntry != null) {
          String entryPath = jarEntry.getName();
View Full Code Here

Examples of java.util.zip.DeflaterInputStream.available()

     * @tests DeflaterInputStream#available()
     */
    public void testAvailable() throws IOException {
        byte[] buf = new byte[1024];
        DeflaterInputStream dis = new DeflaterInputStream(is);
        assertEquals(1, dis.available());
        assertEquals(120, dis.read());
        assertEquals(1, dis.available());
        assertEquals(22, dis.read(buf, 0, 1024));
        assertEquals(1, dis.available());
        assertEquals(-1, dis.read());
View Full Code Here

Examples of java.util.zip.GZIPInputStream.available()

   
    /* Inflate deflated data. */
    try{
      gzipInputStream = new GZIPInputStream(byteArrayInputStream);
     
      while(gzipInputStream.available() > 0){
        if(!buffer.hasRemaining()){
          nbytes += buffer.position();
         
          buffer.flip();
          buffers.add(buffer);
View Full Code Here

Examples of java.util.zip.InflaterInputStream.available()

        Assert.assertEquals("3", IOUtils.readString(inf1));
        Assert.assertEquals("4", IOUtils.readString(inf1));
        Assert.assertEquals("5", IOUtils.readString(inf1));
        Assert.assertEquals("6", IOUtils.readString(inf1));

        Assert.assertEquals(1, inf1.available());
        Assert.assertEquals(-1, inf1.read());
        Assert.assertEquals(0, inf1.available());
    }

}
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.