325N/A/*
325N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage com.sun.xml.internal.ws.api.message;
325N/A
325N/Aimport com.sun.istack.internal.NotNull;
325N/A
325N/Aimport javax.activation.DataHandler;
325N/Aimport javax.xml.soap.SOAPMessage;
325N/Aimport javax.xml.soap.SOAPException;
325N/Aimport javax.xml.transform.Source;
325N/Aimport java.io.IOException;
325N/Aimport java.io.InputStream;
325N/Aimport java.io.OutputStream;
325N/A
325N/A/**
325N/A * Attachment.
325N/A */
325N/Apublic interface Attachment {
325N/A
325N/A /**
325N/A * Content ID of the attachment. Uniquely identifies an attachment.
325N/A *
325N/A * @return
325N/A * The content ID like "foo-bar-zot@abc.com", without
325N/A * surrounding '<' and '>' used as the transfer syntax.
325N/A */
325N/A @NotNull String getContentId();
325N/A
325N/A /**
325N/A * Gets the MIME content-type of this attachment.
325N/A */
325N/A String getContentType();
325N/A
325N/A /**
325N/A * Gets the attachment as an exact-length byte array.
325N/A */
325N/A byte[] asByteArray();
325N/A
325N/A /**
325N/A * Gets the attachment as a {@link DataHandler}.
325N/A */
325N/A DataHandler asDataHandler();
325N/A
325N/A /**
325N/A * Gets the attachment as a {@link Source}.
325N/A * Note that there's no guarantee that the attachment is actually an XML.
325N/A */
325N/A Source asSource();
325N/A
325N/A /**
325N/A * Obtains this attachment as an {@link InputStream}.
325N/A */
325N/A InputStream asInputStream();
325N/A
325N/A /**
325N/A * Writes the contents of the attachment into the given stream.
325N/A */
325N/A void writeTo(OutputStream os) throws IOException;
325N/A
325N/A /**
325N/A * Writes this attachment to the given {@link SOAPMessage}.
325N/A */
325N/A void writeTo(SOAPMessage saaj) throws SOAPException;
325N/A}