+ bitstreams[b].getChecksum());
+ bitstreams[b].getName());
    public static void writeAIP(Context context, Item item, String dest)            throws SQLException, IOException, AuthorizeException, MetsException    {        System.out.println("Exporting item hdl:" + item.getHandle());        // Create aip directory        java.io.File aipDir = new java.io.File(dest                + URLEncoder.encode("hdl:" + item.getHandle(), "UTF-8"));        if (!aipDir.mkdir())        {            // Couldn't make the directory for some reason            throw new IOException("Couldn't create " + aipDir.toString());        }        // Write the METS file        FileOutputStream out = new FileOutputStream(aipDir.toString()                + java.io.File.separator + "mets.xml");        writeMETS(context, item, out);        out.close();        // Write bitstreams        Bundle[] bundles = item.getBundles();        for (int i = 0; i < bundles.length; i++)        {            Bitstream[] bitstreams = bundles[i].getBitstreams();            for (int b = 0; b < bitstreams.length; b++)            {                // Skip license bitstream and unauthorized resources                if ((bitstreams[b].getFormat().getID() != licenseFormat)                        && AuthorizeManager.authorizeActionBoolean(context,                                bitstreams[b], Constants.READ))                {                    out = new FileOutputStream(aipDir.toString()                            + java.io.File.separator                            + bitstreams[b].getChecksum());                    InputStream in = bitstreams[b].retrieve();                    Utils.bufferedCopy(in, out);                    out.close();                    in.close();                }            }        }    }