Code example for DataInputStream

Methods: available, readFully

     * @return The filled InputStream 
     * @throws IOException if the Streams couldn't be created. 
    private static InputStream fullStream(String fname) throws IOException {
        FileInputStream fis = new FileInputStream(fname);
        DataInputStream dis = new DataInputStream(fis);
        byte[] bytes = new byte[dis.available()];
        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        return bais;
     * <p>Takes two file names for a key and the certificate for the key, 
     * and imports those into a keystore. Optionally it takes an alias 
     * for the key. 
     * <p>The first argument is the filename for the key. The key should be 
     * in PKCS8-format. 
     * <p>The second argument is the filename for the certificate for the key. 
     * <p>If a third argument is given it is used as the alias. If missing, 
     * the key is imported with the alias importkey