Package java.io

Examples of java.io.InputStream.available()


    InputStream strm = getClass().getResourceAsStream(ROOT_PATH+path);
    if (strm == null) {
      this.sendErrorPage(ctx, 404, l10n("pathNotFoundTitle"), l10n("pathNotFound"));
      return;
    }
    Bucket data = ctx.getBucketFactory().makeBucket(strm.available());
    OutputStream os = data.getOutputStream();
    try {
    byte[] cbuf = new byte[4096];
    while(true) {
      int r = strm.read(cbuf);
View Full Code Here


     * @param Private Certificate for the receiver of the message.
     */
    public void decryptBody(Certificate PrivateKey) {
        InputStream inStream = new ByteArrayInputStream(PrivateKey.getCertificate());
        try {
            byte[] keyBytes = new byte[inStream.available()];
            inStream.read(keyBytes);

            PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
            PrivateKey key = (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
View Full Code Here

                    out.mkdir();
                } else {
                    InputStream inStream = jar.getInputStream(entry);
                    OutputStream outStream = new FileOutputStream(out);
                   
                    while (inStream.available() > 0) {
                        outStream.write(inStream.read());
                    }
                   
                    inStream.close();
                    outStream.close();
View Full Code Here

      try {
        in = classLoader.getResourceAsStream(languageFileName);
        if (in == null) {
          continue;
        }
        assert in.available() > 0;
                LangProfile profile = LangProfileFactory.readProfile(in);
                addProfile(profile, index, languages.length);
                ++index;
            } catch (IOException e) {
                throw new LangDetectException(ErrorCode.FileLoadError, "can't open '" + languageFileName + "'");
View Full Code Here

        if(session == null) {
            // In our experience this only happens under IBM 1.4.x when
            // spurious (unrelated) certificates show up in the server'
            // chain.  Hopefully this will unearth the real problem:
            InputStream in = ssl.getInputStream();
            in.available();
            /*
              If you're looking at the 2 lines of code above because
              you're running into a problem, you probably have two
              options:

View Full Code Here

        }
        InputStream is = url.openStream();
        if (is == null) {
            throw new IllegalStateException("An exception occurs during implementation class manipulation : cannot read the class file " + url);
        }
        byte[] b = new byte[is.available()];
        is.read(b);
        return b;
    }

    /**
 
View Full Code Here

                if ((args.length > 1) && args[1].equals("bfd")) {
                    POIFSFileSystem fs =
                            new POIFSFileSystem(new FileInputStream(args[0]));
                    InputStream stream =
                            fs.createDocumentInputStream("Workbook");
                    int size = stream.available();
                    byte[] data = new byte[size];

                    stream.read(data);
                    HexDump.dump(data, 0, System.out, 0);
                } else {
View Full Code Here

    File file = new File(path);
    long size;
    if (file.exists()) {
      size = file.length();
    } else {
      size = is.available();
    }
    if (path.endsWith(".gz")) {
      is = new GZIPInputStream(is);
      // guestimate:
      size *= 2.8;
View Full Code Here

        }
        InputStream is = null;
        try {
            is = servletConfig.getServletContext().getResourceAsStream(location);
           
            if (is == null || is.available() == -1) {
                URIResolver resolver = new URIResolver(location);

                if (resolver.isResolved()) {
                    is = resolver.getInputStream();
                }
View Full Code Here

        BigInteger lastMessageNr = seq.getLastMessageNumber();
        updateDestSequenceStmt.setBigDecimal(1, lastMessageNr == null ? null
            : new BigDecimal(lastMessageNr));
        InputStream is = PersistenceUtils.getInstance()
            .serialiseAcknowledgment(seq.getAcknowledgment());
        updateDestSequenceStmt.setBinaryStream(2, is, is.available());
        updateDestSequenceStmt.setString(3, seq.getIdentifier() .getValue());
        updateDestSequenceStmt.execute();
    }
   
    protected void createTables() throws SQLException {
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.