< prev index next >

src/java.xml.ws/share/classes/javax/xml/soap/AttachmentPart.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 48,66 **** * <UL> * <LI>{@code Content-Type}<br> * This header identifies the type of data in the content of an * {@code AttachmentPart} object and MUST conform to [RFC2045]. * The following is an example of a Content-Type header: ! * <PRE> * Content-Type: application/xml ! * </PRE> * The following line of code, in which {@code ap} is an * {@code AttachmentPart} object, sets the header shown in * the previous example. ! * <PRE> * ap.setMimeHeader("Content-Type", "application/xml"); ! * </PRE> * </UL> * </OL> * <p> * There are no restrictions on the content portion of an {@code * AttachmentPart} object. The content may be anything from a --- 48,66 ---- * <UL> * <LI>{@code Content-Type}<br> * This header identifies the type of data in the content of an * {@code AttachmentPart} object and MUST conform to [RFC2045]. * The following is an example of a Content-Type header: ! * {@code * Content-Type: application/xml ! * } * The following line of code, in which {@code ap} is an * {@code AttachmentPart} object, sets the header shown in * the previous example. ! * {@code * ap.setMimeHeader("Content-Type", "application/xml"); ! * } * </UL> * </OL> * <p> * There are no restrictions on the content portion of an {@code * AttachmentPart} object. The content may be anything from a
*** 77,120 **** * {@code SOAPMessage} object and {@code contentStringl} is a * {@code String}, creates an instance of {@code AttachmentPart}, * sets the {@code AttachmentPart} object with some content and * header information, and adds the {@code AttachmentPart} object to * the {@code SOAPMessage} object. ! * <PRE> * AttachmentPart ap1 = m.createAttachmentPart(); * ap1.setContent(contentString1, "text/plain"); * m.addAttachmentPart(ap1); ! * </PRE> * * * <p> * The following code fragment creates and adds a second * {@code AttachmentPart} instance to the same message. {@code jpegData} * is a binary byte buffer representing the jpeg file. ! * <PRE> * AttachmentPart ap2 = m.createAttachmentPart(); * byte[] jpegData = ...; * ap2.setContent(new ByteArrayInputStream(jpegData), "image/jpeg"); * m.addAttachmentPart(ap2); ! * </PRE> * <p> * The {@code getContent} method retrieves the contents and header from * an {@code AttachmentPart} object. Depending on the * {@code DataContentHandler} objects present, the returned * {@code Object} can either be a typed Java object corresponding * to the MIME type or an {@code InputStream} object that contains the * content as bytes. ! * <PRE> * String content1 = ap1.getContent(); * java.io.InputStream content2 = ap2.getContent(); ! * </PRE> * * The method {@code clearContent} removes all the content from an * {@code AttachmentPart} object but does not affect its header information. ! * <PRE> * ap1.clearContent(); ! * </PRE> * * @since 1.6 */ public abstract class AttachmentPart { --- 77,120 ---- * {@code SOAPMessage} object and {@code contentStringl} is a * {@code String}, creates an instance of {@code AttachmentPart}, * sets the {@code AttachmentPart} object with some content and * header information, and adds the {@code AttachmentPart} object to * the {@code SOAPMessage} object. ! * {@code * AttachmentPart ap1 = m.createAttachmentPart(); * ap1.setContent(contentString1, "text/plain"); * m.addAttachmentPart(ap1); ! * } * * * <p> * The following code fragment creates and adds a second * {@code AttachmentPart} instance to the same message. {@code jpegData} * is a binary byte buffer representing the jpeg file. ! * {@code * AttachmentPart ap2 = m.createAttachmentPart(); * byte[] jpegData = ...; * ap2.setContent(new ByteArrayInputStream(jpegData), "image/jpeg"); * m.addAttachmentPart(ap2); ! * } * <p> * The {@code getContent} method retrieves the contents and header from * an {@code AttachmentPart} object. Depending on the * {@code DataContentHandler} objects present, the returned * {@code Object} can either be a typed Java object corresponding * to the MIME type or an {@code InputStream} object that contains the * content as bytes. ! * {@code * String content1 = ap1.getContent(); * java.io.InputStream content2 = ap2.getContent(); ! * } * * The method {@code clearContent} removes all the content from an * {@code AttachmentPart} object but does not affect its header information. ! * {@code * ap1.clearContent(); ! * } * * @since 1.6 */ public abstract class AttachmentPart {
< prev index next >