Package org.apache.xml.security.stax.impl.util

Examples of org.apache.xml.security.stax.impl.util.UnsynchronizedByteArrayOutputStream


                            private XMLEventWriter xmlEventWriter;

                            @Override
                            public void transform(Object object) throws XMLStreamException {
                                if (xmlEventWriter == null) {
                                    baos = new UnsynchronizedByteArrayOutputStream();
                                    xmlEventWriter = getXmlOutputFactory().createXMLEventWriter(baos);
                                }

                                xmlEventWriter.add((XMLSecEvent) object);
                            }
View Full Code Here


    }

    @Override
    public void setTransformer(Transformer transformer) throws XMLSecurityException {
        //we support only transformers which takes an InputStream otherwise we will break the C14N
        setOutputStream(new UnsynchronizedByteArrayOutputStream());
        super.setTransformer(transformer);
    }
View Full Code Here

    }

    @Override
    public void doFinal() throws XMLStreamException {
        if (getTransformer() != null) {
            UnsynchronizedByteArrayOutputStream baos = (UnsynchronizedByteArrayOutputStream)getOutputStream();
            getTransformer().transform(new UnsynchronizedByteArrayInputStream(baos.toByteArray()));
            getTransformer().doFinal();
        }
    }
View Full Code Here

    }

    @Override
    public void setTransformer(Transformer transformer) throws XMLSecurityException {
        //we support only transformers which takes an InputStream otherwise we will break the C14N
        setOutputStream(new UnsynchronizedByteArrayOutputStream());
        super.setTransformer(transformer);
    }
View Full Code Here

    }

    @Override
    public void doFinal() throws XMLStreamException {
        if (getTransformer() != null) {
            UnsynchronizedByteArrayOutputStream baos = (UnsynchronizedByteArrayOutputStream)getOutputStream();
            getTransformer().transform(new UnsynchronizedByteArrayInputStream(baos.toByteArray()));
            getTransformer().doFinal();
        }
    }
View Full Code Here

                            private XMLEventWriter xmlEventWriter;

                            @Override
                            public void transform(Object object) throws XMLStreamException {
                                if (xmlEventWriter == null) {
                                    baos = new UnsynchronizedByteArrayOutputStream();
                                    xmlEventWriter = getXmlOutputFactory().createXMLEventWriter(baos);
                                }

                                xmlEventWriter.add((XMLSecEvent) object);
                            }
View Full Code Here

                                    private Base64OutputStream base64OutputStream;

                                    @Override
                                    public void transform(Object object) throws XMLStreamException {
                                        if (base64OutputStream == null) {
                                            byteArrayOutputStream = new UnsynchronizedByteArrayOutputStream();
                                            base64OutputStream = new Base64OutputStream(byteArrayOutputStream, false);
                                        }
                                        try {
                                            base64OutputStream.write(((byte[]) object));
                                        } catch (IOException e) {
                                            throw new XMLStreamException(e);
                                        }
                                    }

                                    @Override
                                    public void doFinal() throws XMLStreamException {
                                        try {
                                            base64OutputStream.close();
                                        } catch (IOException e) {
                                            throw new XMLStreamException(e);
                                        }
                                        XMLEventReaderInputProcessor xmlEventReaderInputProcessor
                                                = new XMLEventReaderInputProcessor(
                                                null,
                                                getXmlInputFactory().createXMLStreamReader(new UnsynchronizedByteArrayInputStream(byteArrayOutputStream.toByteArray()))
                                        );

                                        try {
                                            XMLSecEvent xmlSecEvent;
                                            do {
                                                xmlSecEvent = xmlEventReaderInputProcessor.processNextEvent(null);
                                                getTransformer().transform(xmlSecEvent);
                                            } while (xmlSecEvent.getEventType() != XMLStreamConstants.END_DOCUMENT);
                                        } catch (XMLSecurityException e) {
                                            throw new XMLStreamException(e);
                                        }
                                        getTransformer().doFinal();
                                    }
                                };
                                break;
                            }
                            case InputStream: {
                                childOutputMethod = new ChildOutputMethod() {

                                    private UnsynchronizedByteArrayOutputStream byteArrayOutputStream;
                                    private Base64OutputStream base64OutputStream;

                                    @Override
                                    public void transform(Object object) throws XMLStreamException {
                                        if (base64OutputStream == null) {
                                            byteArrayOutputStream = new UnsynchronizedByteArrayOutputStream();
                                            base64OutputStream = new Base64OutputStream(byteArrayOutputStream, false);
                                        }
                                        try {
                                            base64OutputStream.write(((byte[]) object));
                                        } catch (IOException e) {
View Full Code Here

    }

    @Override
    public void setTransformer(Transformer transformer) throws XMLSecurityException {
        //we support only transformers which takes an InputStream otherwise we will break the C14N
        setOutputStream(new UnsynchronizedByteArrayOutputStream());
        super.setTransformer(transformer);
    }
View Full Code Here

    }

    @Override
    public void doFinal() throws XMLStreamException {
        if (getTransformer() != null) {
            UnsynchronizedByteArrayOutputStream baos = (UnsynchronizedByteArrayOutputStream)getOutputStream();
            getTransformer().transform(new UnsynchronizedByteArrayInputStream(baos.toByteArray()));
            getTransformer().doFinal();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.xml.security.stax.impl.util.UnsynchronizedByteArrayOutputStream

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.