Package java.io

Examples of java.io.BufferedInputStream.available()


      FileInputStream datafis = new FileInputStream(filename);
      InputStream buf = new BufferedInputStream(datafis);

      byte[] temp = new byte[1024];
      int length = 0;
      while (buf.available() != 0) {
        length = buf.read(temp);
        sig.update(temp, 0, length);
      }
      buf.close();
View Full Code Here


                // stop reading, so we cannot block
                // TODO propery implement support for chunked transfer, i.e. to
                // know when we have read the whole request, and therefore allow
                // the reading to block
                log.debug("Chunked");
                while(in.available() > 0 && ((length = in.read(buffer)) != -1)) {
                    out.write(buffer, 0, length);
                }
            }
            else {
                // The reqest has no body, or it has a transfer encoding we do not support.
View Full Code Here

            }
            else {
                // The reqest has no body, or it has a transfer encoding we do not support.
                // In either case, we read any data available
                log.debug("Other");
                while(in.available() > 0 && ((length = in.read(buffer)) != -1)) {
                    log.debug("Read bytes: "+length);
                    out.write(buffer, 0, length);
                }
            }
            log.debug("Flush");
View Full Code Here

            try
            {
                // read the key, and decode from hex encoding
                BufferedInputStream keystream =
                    new BufferedInputStream(new FileInputStream(keyfile));
                int len = keystream.available();
                byte[] keyhex = new byte[len];
                keystream.read(keyhex, 0, len);
                key = Hex.decode(keyhex);
            }
            catch (IOException ioe)
View Full Code Here

    StringBuffer inString = new StringBuffer();
    ByteArrayOutputStream holdStream = new ByteArrayOutputStream();

    // _TODO Optimize this read_
    while (inStream.available() != 0) {
      holdStream.write(inStream.read());
    }

    // Convert this string from Base64 t0 binary
    byte[] base64Bytes = holdStream.toByteArray();
View Full Code Here

    public static byte[] getBytesFromResource( String resource ) throws IOException
    {
        InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream( resource );

        BufferedInputStream stream = new BufferedInputStream( is );
        int len = stream.available();
        byte[] bytes = new byte[len];
        stream.read( bytes, 0, len );

        return bytes;
    }
View Full Code Here

            InputStream stream = connection.getInputStream();
            Debug.logInfo("getContentLength is :"+contentLength, module);

            in = new BufferedInputStream(stream);

            long totalBytes = in.available();
            Debug.logInfo("totalBytes is : "+totalBytes, module);

            byte[] b = new byte[1024];

            FileOutputStream file = new FileOutputStream(libPath);
View Full Code Here

            while (entries.hasMoreElements()) {
                final ZipEntry entry = entries.nextElement();

                final BufferedInputStream bufferedInputStream = new BufferedInputStream(zipFile.getInputStream(entry));
                final byte[] captchaCharData = new byte[bufferedInputStream.available()];

                bufferedInputStream.read(captchaCharData);
                bufferedInputStream.close();

                final Image image = IMAGE_SERVICE.makeImage(captchaCharData);
View Full Code Here

    BufferedInputStream bis = new BufferedInputStream(
        new ByteArrayInputStream(new byte[] { 'h', 'e', 'l', 'l', 'o',
            ' ', 't', 'i', 'm' }));
    int available;
    try {
      available = bis.available();
      bis.close();
    } catch (IOException ex) {
      fail();
      return; // never reached.
    }
View Full Code Here

      return; // never reached.
    }
    assertTrue(available != 0);

    try {
      bis.available();
      fail("Expected test to throw IOE.");
    } catch (IOException ex) {
      // expected
    } catch (Throwable ex) {
      fail("Expected test to throw IOE not "
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.