Package java.io

Examples of java.io.ByteArrayInputStream.available()


                      bais.available() );
                }
                               
                ps.setBinaryStream(i+1,
                                                   bais,
                           bais.available() );
                               
              }
             
            }
            break;
View Full Code Here


                        cf = CertificateFactory.getInstance("X.509");
                    } else {
                        cf = CertificateFactory.getInstance("X.509",
                                clientCertProvider);
                    }
                    while(bais.available() > 0) {
                        X509Certificate cert = (X509Certificate)
                        cf.generateCertificate(bais);
                        if(jsseCerts == null) {
                            jsseCerts = new X509Certificate[1];
                            jsseCerts[0] = cert;
View Full Code Here

    ByteArrayInputStream bis1 =  new ByteArrayInputStream(BLOCK.getBytes("ISO-8859-1"));
    ByteArrayInputStream bis2 =  new ByteArrayInputStream(BLOCK.getBytes("ISO-8859-1"));
    LineReadingInputStream lris1 = new LineReadingInputStream(bis1);
    LineReadingInputStream lris2 = new LineReadingInputStream(bis2);
   
    while(bis1.available() > 0 || bis2.available() > 0) {
      String stringWithoutMark =lris2.readLineWithoutMarking(MAX_LENGTH*10, BUFFER_SIZE, true);
      String stringWithMark = lris1.readLine(MAX_LENGTH*10, BUFFER_SIZE, true);
      assertEquals(stringWithMark, stringWithoutMark);
    }
    assertNull(lris1.readLine(MAX_LENGTH, BUFFER_SIZE, true));
View Full Code Here

    byte[] salt = new byte[saltLen];
    if (saltLen != bais.read(salt)) {
      throw new IllegalArgumentException();
    }

    int ciphertextLength = bais.available();
    if (ciphertextLength <= 0) {
      throw new IllegalArgumentException();
    }

    byte[] ciphertext = new byte[ciphertextLength];
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

        byte[] authorities = TlsUtils.readOpaque16(input);

        Vector authorityDNs = new Vector();

        ByteArrayInputStream bis = new ByteArrayInputStream(authorities);
        while (bis.available() > 0)
        {
            byte[] dnBytes = TlsUtils.readOpaque16(bis);
            authorityDNs.addElement(X500Name.getInstance(ASN1Primitive.fromByteArray(dnBytes)));
        }
View Full Code Here

        ByteArrayInputStream buf = new ByteArrayInputStream(extBytes);

        // Integer -> byte[]
        Hashtable extensions = new Hashtable();

        while (buf.available() > 0)
        {
            Integer extType = Integers.valueOf(TlsUtils.readUint16(buf));
            byte[] extValue = TlsUtils.readOpaque16(buf);

            /*
 
View Full Code Here

        ByteArrayInputStream buf = new ByteArrayInputStream(supp_data);

        Vector supplementalData = new Vector();

        while (buf.available() > 0)
        {
            int supp_data_type = TlsUtils.readUint16(buf);
            byte[] data = TlsUtils.readOpaque16(buf);

            supplementalData.addElement(new SupplementalDataEntry(supp_data_type, data));
View Full Code Here

                catch (IOException e)
                {
                    throw new InvalidCipherTextException("unable to recover ephemeral public key: " + e.getMessage(), e);
                }

                int encLength = (inLen - bIn.available());
                this.V = Arrays.copyOfRange(in, inOff, inOff + encLength);
            }
        }

        // Compute the common value and convert to byte array.
View Full Code Here

            else
            {
                throw new UnsupportedEncodingException("Unknown encoding: " +
                                                    encoding);
            }
            len = bis.available();
            bytes = new byte[len];
            len = is.read(bytes, 0, len);
            String ret = new String(bytes, 0, len, charset);
            if (text.length() > end + 2)
            {
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.