jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/BMMimeMultipart.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
113 * A unique boundary string is generated and this string is |
113 * A unique boundary string is generated and this string is |
114 * setup as the "boundary" parameter for the |
114 * setup as the "boundary" parameter for the |
115 * <code>contentType</code> field. <p> |
115 * <code>contentType</code> field. <p> |
116 * |
116 * |
117 * MimeBodyParts may be added later. |
117 * MimeBodyParts may be added later. |
|
118 * |
|
119 * @param subtype subtype. |
118 */ |
120 */ |
119 public BMMimeMultipart(String subtype) { |
121 public BMMimeMultipart(String subtype) { |
120 super(subtype); |
122 super(subtype); |
121 /* |
123 /* |
122 * Compute a boundary string. |
124 * Compute a boundary string. |
140 * the data for the body parts are needed, the parser extracts the |
142 * the data for the body parts are needed, the parser extracts the |
141 * "boundary" parameter from the content type of this DataSource, |
143 * "boundary" parameter from the content type of this DataSource, |
142 * skips the 'preamble' and reads bytes till the terminating |
144 * skips the 'preamble' and reads bytes till the terminating |
143 * boundary and creates MimeBodyParts for each part of the stream. |
145 * boundary and creates MimeBodyParts for each part of the stream. |
144 * |
146 * |
145 * @param ds DataSource, can be a MultipartDataSource |
147 * @param ds DataSource, can be a MultipartDataSource. |
|
148 * @param ct content type. |
|
149 * @exception MessagingException in case of error. |
146 */ |
150 */ |
147 public BMMimeMultipart(DataSource ds, ContentType ct) |
151 public BMMimeMultipart(DataSource ds, ContentType ct) |
148 throws MessagingException { |
152 throws MessagingException { |
149 super(ds,ct); |
153 super(ds,ct); |
150 boundary = ct.getParameter("boundary"); |
154 boundary = ct.getParameter("boundary"); |
195 * method is called by all other methods that need data for |
199 * method is called by all other methods that need data for |
196 * the body parts, to make sure the data has been parsed. |
200 * the body parts, to make sure the data has been parsed. |
197 * |
201 * |
198 * @since JavaMail 1.2 |
202 * @since JavaMail 1.2 |
199 */ |
203 */ |
|
204 @Override |
200 protected void parse() throws MessagingException { |
205 protected void parse() throws MessagingException { |
201 if (parsed) |
206 if (parsed) |
202 return; |
207 return; |
203 |
208 |
204 initStream(); |
209 initStream(); |
692 /** |
697 /** |
693 * Iterates through all the parts and outputs each Mime part |
698 * Iterates through all the parts and outputs each Mime part |
694 * separated by a boundary. |
699 * separated by a boundary. |
695 */ |
700 */ |
696 |
701 |
|
702 @Override |
697 public void writeTo(OutputStream os) |
703 public void writeTo(OutputStream os) |
698 throws IOException, MessagingException { |
704 throws IOException, MessagingException { |
699 |
705 |
700 // inputStream was not null |
706 // inputStream was not null |
701 if (in != null) { |
707 if (in != null) { |