Package org.fcrepo.server.journal.helpers

Examples of org.fcrepo.server.journal.helpers.DecodingBase64OutputStream


                                    ConsumerJournalEntry journalEntry,
                                    String name) throws XMLStreamException,
            JournalException {
        try {
            File tempFile = JournalHelper.createTempFile();
            DecodingBase64OutputStream decoder =
                    new DecodingBase64OutputStream(new FileOutputStream(tempFile));

            while (true) {
                XMLEvent event = reader.nextEvent();
                if (event.isCharacters()) {
                    decoder.write(event.asCharacters().getData());
                } else if (isEndTagEvent(event, QNAME_TAG_ARGUMENT)) {
                    break;
                } else {
                    throw getUnexpectedEventInArgumentException(name,
                                                                ARGUMENT_TYPE_STREAM,
                                                                journalEntry
                                                                        .getMethodName(),
                                                                event);
                }
            }
            decoder.close();
            journalEntry.addArgument(name, tempFile);
        } catch (IOException e) {
            throw new JournalException("failed to write stream argument to temp file",
                                       e);
        }
View Full Code Here


                                                 String encodedString)
            throws FileNotFoundException, IOException {
        int maxChunkSize = 61;
        int length = encodedString.length();

        DecodingBase64OutputStream decoder =
                new DecodingBase64OutputStream(new FileOutputStream(target));

        int start = 0;
        int remainder;
        while (0 < (remainder = length - start)) {
            int chunkSize = Math.min(remainder, maxChunkSize);
            String chunk = encodedString.substring(start, start + chunkSize);
            decoder.write(chunk);
            start += chunkSize;
        }
        decoder.close();
    }
View Full Code Here

TOP

Related Classes of org.fcrepo.server.journal.helpers.DecodingBase64OutputStream

Copyright © 2018 www.massapicom. 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.