com.sun.xml.internal.messaging.saaj.util.ByteOutputStream Java Examples
The following examples show how to use
com.sun.xml.internal.messaging.saaj.util.ByteOutputStream.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JaxbParser.java From sword-lang with Apache License 2.0 | 6 votes |
/** * 转为xml串 * @param obj * @return */ public String toXML(Object obj){ String result = null; try { JAXBContext context = JAXBContext.newInstance(obj.getClass()); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.setProperty(Marshaller.JAXB_FRAGMENT, true);// 去掉报文头 OutputStream os = new ByteOutputStream(); StringWriter writer = new StringWriter(); XMLSerializer serializer = getXMLSerializer(os); m.marshal(obj, serializer.asContentHandler()); result = os.toString(); } catch (Exception e) { e.printStackTrace(); } logger.info("response text:" + result); return result; }
Example #2
Source File: ASCIIUtility.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * * @deprecated * this is an expensive operation that require an additional * buffer reallocation just to get the array of an exact size. * Unless you absolutely need the exact size array, don't use this. * Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}. */ public static byte[] getBytes(InputStream is) throws IOException { ByteOutputStream bos = new ByteOutputStream(); try { bos.write(is); } finally { is.close(); } return bos.toByteArray(); }
Example #3
Source File: BMMimeMultipart.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private int readBody( InputStream is, byte[] pattern, long[] posVector, ByteOutputStream baos, SharedInputStream sin) throws Exception { if (!find(is, pattern, posVector, baos, sin)) { throw new Exception( "Missing boundary delimitier while reading Body Part"); } return b; }
Example #4
Source File: AttachmentPartImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public void setBase64Content(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; InputStream decoded = null; try { decoded = MimeUtility.decode(content, "base64"); InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on the InputStream // has markSupported()==true ByteOutputStream bos = new ByteOutputStream(); bos.write(decoded); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); } catch (Exception e) { log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { try { decoded.close(); } catch (IOException ex) { throw new SOAPException(ex); } } }
Example #5
Source File: AttachmentPartImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public void setRawContent(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; try { InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on whether the InputStream has // markSupported()==true or false ByteOutputStream bos = new ByteOutputStream(); bos.write(content); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); } catch (Exception e) { log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { try { content.close(); } catch (IOException ex) { throw new SOAPException(ex); } } }
Example #6
Source File: BMMimeMultipart.java From hottub with GNU General Public License v2.0 | 5 votes |
private int readBody( InputStream is, byte[] pattern, long[] posVector, ByteOutputStream baos, SharedInputStream sin) throws Exception { if (!find(is, pattern, posVector, baos, sin)) { throw new Exception( "Missing boundary delimitier while reading Body Part"); } return b; }
Example #7
Source File: BMMimeMultipart.java From hottub with GNU General Public License v2.0 | 5 votes |
public void writeTo(OutputStream os) throws IOException, MessagingException { // inputStream was not null if (in != null) { contentType.setParameter("boundary", this.boundary); } String bnd = "--" + contentType.getParameter("boundary"); for (int i = 0; i < parts.size(); i++) { OutputUtil.writeln(bnd, os); // put out boundary ((MimeBodyPart)parts.get(i)).writeTo(os); OutputUtil.writeln(os); // put out empty line } if (in != null) { OutputUtil.writeln(bnd, os); // put out boundary if ((os instanceof ByteOutputStream) && lazyAttachments) { ((ByteOutputStream)os).write(in); } else { ByteOutputStream baos = new ByteOutputStream(in.available()); baos.write(in); baos.writeTo(os); // reset the inputstream so that we can support a //getAttachment later in = baos.newInputStream(); } // this will endup writing the end boundary } else { // put out last boundary OutputUtil.writeAsAscii(bnd, os); OutputUtil.writeAsAscii("--", os); } }
Example #8
Source File: ASCIIUtility.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * * @deprecated * this is an expensive operation that require an additional * buffer reallocation just to get the array of an exact size. * Unless you absolutely need the exact size array, don't use this. * Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}. */ public static byte[] getBytes(InputStream is) throws IOException { ByteOutputStream bos = new ByteOutputStream(); try { bos.write(is); } finally { is.close(); } return bos.toByteArray(); }
Example #9
Source File: AttachmentPartImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void setBase64Content(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; InputStream decoded = null; try { decoded = MimeUtility.decode(content, "base64"); InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on the InputStream // has markSupported()==true ByteOutputStream bos = new ByteOutputStream(); bos.write(decoded); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); } catch (Exception e) { log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { try { decoded.close(); } catch (IOException ex) { throw new SOAPException(ex); } } }
Example #10
Source File: AttachmentPartImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void setRawContent(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; try { InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on whether the InputStream has // markSupported()==true or false ByteOutputStream bos = new ByteOutputStream(); bos.write(content); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); } catch (Exception e) { log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { try { content.close(); } catch (IOException ex) { throw new SOAPException(ex); } } }
Example #11
Source File: BMMimeMultipart.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private int readBody( InputStream is, byte[] pattern, long[] posVector, ByteOutputStream baos, SharedInputStream sin) throws Exception { if (!find(is, pattern, posVector, baos, sin)) { throw new Exception( "Missing boundary delimitier while reading Body Part"); } return b; }
Example #12
Source File: BMMimeMultipart.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void writeTo(OutputStream os) throws IOException, MessagingException { // inputStream was not null if (in != null) { contentType.setParameter("boundary", this.boundary); } String bnd = "--" + contentType.getParameter("boundary"); for (int i = 0; i < parts.size(); i++) { OutputUtil.writeln(bnd, os); // put out boundary ((MimeBodyPart)parts.get(i)).writeTo(os); OutputUtil.writeln(os); // put out empty line } if (in != null) { OutputUtil.writeln(bnd, os); // put out boundary if ((os instanceof ByteOutputStream) && lazyAttachments) { ((ByteOutputStream)os).write(in); } else { ByteOutputStream baos = new ByteOutputStream(in.available()); baos.write(in); baos.writeTo(os); // reset the inputstream so that we can support a //getAttachment later in = baos.newInputStream(); } // this will endup writing the end boundary } else { // put out last boundary OutputUtil.writeAsAscii(bnd, os); OutputUtil.writeAsAscii("--", os); } }
Example #13
Source File: AttachmentPartImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void setRawContent(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; try { InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on whether the InputStream has // markSupported()==true or false ByteOutputStream bos = new ByteOutputStream(); bos.write(content); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); } catch (Exception e) { log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { try { content.close(); } catch (IOException ex) { throw new SOAPException(ex); } } }
Example #14
Source File: AttachmentPartImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void setBase64Content(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; InputStream decoded = null; try { decoded = MimeUtility.decode(content, "base64"); InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on the InputStream // has markSupported()==true ByteOutputStream bos = new ByteOutputStream(); bos.write(decoded); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); } catch (Exception e) { log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { try { decoded.close(); } catch (IOException ex) { throw new SOAPException(ex); } } }
Example #15
Source File: AttachmentPartImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void setRawContent(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; try { InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on whether the InputStream has // markSupported()==true or false ByteOutputStream bos = new ByteOutputStream(); bos.write(content); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); } catch (Exception e) { log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { try { content.close(); } catch (IOException ex) { throw new SOAPException(ex); } } }
Example #16
Source File: BMMimeMultipart.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private int readBody( InputStream is, byte[] pattern, long[] posVector, ByteOutputStream baos, SharedInputStream sin) throws Exception { if (!find(is, pattern, posVector, baos, sin)) { throw new Exception( "Missing boundary delimitier while reading Body Part"); } return b; }
Example #17
Source File: BMMimeMultipart.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void writeTo(OutputStream os) throws IOException, MessagingException { // inputStream was not null if (in != null) { contentType.setParameter("boundary", this.boundary); } String bnd = "--" + contentType.getParameter("boundary"); for (int i = 0; i < parts.size(); i++) { OutputUtil.writeln(bnd, os); // put out boundary ((MimeBodyPart)parts.get(i)).writeTo(os); OutputUtil.writeln(os); // put out empty line } if (in != null) { OutputUtil.writeln(bnd, os); // put out boundary if ((os instanceof ByteOutputStream) && lazyAttachments) { ((ByteOutputStream)os).write(in); } else { ByteOutputStream baos = new ByteOutputStream(in.available()); baos.write(in); baos.writeTo(os); // reset the inputstream so that we can support a //getAttachment later in = baos.newInputStream(); } // this will endup writing the end boundary } else { // put out last boundary OutputUtil.writeAsAscii(bnd, os); OutputUtil.writeAsAscii("--", os); } }
Example #18
Source File: ASCIIUtility.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * * @deprecated * this is an expensive operation that require an additional * buffer reallocation just to get the array of an exact size. * Unless you absolutely need the exact size array, don't use this. * Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}. */ public static byte[] getBytes(InputStream is) throws IOException { ByteOutputStream bos = new ByteOutputStream(); try { bos.write(is); } finally { is.close(); } return bos.toByteArray(); }
Example #19
Source File: IOUtil.java From gameserver with Apache License 2.0 | 5 votes |
/** * Compress the string with ZIP method. * @param content * @return */ public static byte[] compressString(String entryName, String content) { try { ByteOutputStream bos = new ByteOutputStream(10000); ZipOutputStream zos = new ZipOutputStream(bos); ZipEntry entry = new ZipEntry(entryName); zos.putNextEntry(entry); zos.write(content.getBytes("utf8")); zos.flush(); zos.close(); byte[] fileBytes = new byte[bos.size()]; System.arraycopy(bos.getBytes(), 0, fileBytes, 0, fileBytes.length); return fileBytes; } catch (IOException e) { logger.warn("Failed to zip string.", e); } return null; }
Example #20
Source File: IOUtil.java From gameserver with Apache License 2.0 | 5 votes |
public static byte[] compressStringZlib(String content) { try { ByteOutputStream bos = new ByteOutputStream(10000); DeflaterOutputStream zos = new DeflaterOutputStream(bos); zos.write(content.getBytes("utf8")); zos.flush(); zos.close(); byte[] fileBytes = new byte[bos.size()]; System.arraycopy(bos.getBytes(), 0, fileBytes, 0, fileBytes.length); return fileBytes; } catch (IOException e) { logger.warn("Failed to zip string.", e); } return null; }
Example #21
Source File: AsposeMavenProjectManager.java From Aspose.OCR-for-Java with MIT License | 5 votes |
public void writeXmlDocumentToVirtualFile(VirtualFile pom, Document pomDocument) { RunnableHelper.runWriteCommand(projectHandle, new Runnable() { @Override public void run() { try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); DOMSource source = new DOMSource(pomDocument); ByteOutputStream bytes = new ByteOutputStream(); StreamResult result = new StreamResult(bytes); transformer.transform(source, result); VfsUtil.saveText(pom, bytes.toString()); } catch (TransformerException tfe) { tfe.printStackTrace(); } catch (Exception ex) { ex.printStackTrace(); } } }); }
Example #22
Source File: AttachmentPartImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void setBase64Content(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; InputStream decoded = null; try { decoded = MimeUtility.decode(content, "base64"); InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on the InputStream // has markSupported()==true ByteOutputStream bos = new ByteOutputStream(); bos.write(decoded); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); } catch (Exception e) { log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { try { decoded.close(); } catch (IOException ex) { throw new SOAPException(ex); } } }
Example #23
Source File: AttachmentPartImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void setBase64Content(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; InputStream decoded = null; try { decoded = MimeUtility.decode(content, "base64"); InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on the InputStream // has markSupported()==true ByteOutputStream bos = new ByteOutputStream(); bos.write(decoded); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); } catch (Exception e) { log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { try { decoded.close(); } catch (IOException ex) { throw new SOAPException(ex); } } }
Example #24
Source File: BMMimeMultipart.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private int readBody( InputStream is, byte[] pattern, long[] posVector, ByteOutputStream baos, SharedInputStream sin) throws Exception { if (!find(is, pattern, posVector, baos, sin)) { throw new Exception( "Missing boundary delimitier while reading Body Part"); } return b; }
Example #25
Source File: BMMimeMultipart.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void writeTo(OutputStream os) throws IOException, MessagingException { // inputStream was not null if (in != null) { contentType.setParameter("boundary", this.boundary); } String bnd = "--" + contentType.getParameter("boundary"); for (int i = 0; i < parts.size(); i++) { OutputUtil.writeln(bnd, os); // put out boundary ((MimeBodyPart)parts.get(i)).writeTo(os); OutputUtil.writeln(os); // put out empty line } if (in != null) { OutputUtil.writeln(bnd, os); // put out boundary if ((os instanceof ByteOutputStream) && lazyAttachments) { ((ByteOutputStream)os).write(in); } else { ByteOutputStream baos = new ByteOutputStream(in.available()); baos.write(in); baos.writeTo(os); // reset the inputstream so that we can support a //getAttachment later in = baos.newInputStream(); } // this will endup writing the end boundary } else { // put out last boundary OutputUtil.writeAsAscii(bnd, os); OutputUtil.writeAsAscii("--", os); } }
Example #26
Source File: ASCIIUtility.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * * @deprecated * this is an expensive operation that require an additional * buffer reallocation just to get the array of an exact size. * Unless you absolutely need the exact size array, don't use this. * Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}. */ public static byte[] getBytes(InputStream is) throws IOException { ByteOutputStream bos = new ByteOutputStream(); try { bos.write(is); } finally { is.close(); } return bos.toByteArray(); }
Example #27
Source File: AttachmentPartImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void setBase64Content(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; InputStream decoded = null; try { decoded = MimeUtility.decode(content, "base64"); InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on the InputStream // has markSupported()==true ByteOutputStream bos = new ByteOutputStream(); bos.write(decoded); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); } catch (Exception e) { log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { try { decoded.close(); } catch (IOException ex) { throw new SOAPException(ex); } } }
Example #28
Source File: AttachmentPartImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void setRawContent(InputStream content, String contentType) throws SOAPException { if (mimePart != null) { mimePart.close(); mimePart = null; } dataHandler = null; try { InternetHeaders hdrs = new InternetHeaders(); hdrs.setHeader("Content-Type", contentType); //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart // Ctor with inputStream causes problems based on whether the InputStream has // markSupported()==true or false ByteOutputStream bos = new ByteOutputStream(); bos.write(content); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); setMimeHeader("Content-Type", contentType); } catch (Exception e) { log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e); throw new SOAPExceptionImpl(e.getLocalizedMessage()); } finally { try { content.close(); } catch (IOException ex) { throw new SOAPException(ex); } } }
Example #29
Source File: BMMimeMultipart.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private int readBody( InputStream is, byte[] pattern, long[] posVector, ByteOutputStream baos, SharedInputStream sin) throws Exception { if (!find(is, pattern, posVector, baos, sin)) { throw new Exception( "Missing boundary delimitier while reading Body Part"); } return b; }
Example #30
Source File: BMMimeMultipart.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void writeTo(OutputStream os) throws IOException, MessagingException { // inputStream was not null if (in != null) { contentType.setParameter("boundary", this.boundary); } String bnd = "--" + contentType.getParameter("boundary"); for (int i = 0; i < parts.size(); i++) { OutputUtil.writeln(bnd, os); // put out boundary ((MimeBodyPart)parts.get(i)).writeTo(os); OutputUtil.writeln(os); // put out empty line } if (in != null) { OutputUtil.writeln(bnd, os); // put out boundary if ((os instanceof ByteOutputStream) && lazyAttachments) { ((ByteOutputStream)os).write(in); } else { ByteOutputStream baos = new ByteOutputStream(in.available()); baos.write(in); baos.writeTo(os); // reset the inputstream so that we can support a //getAttachment later in = baos.newInputStream(); } // this will endup writing the end boundary } else { // put out last boundary OutputUtil.writeAsAscii(bnd, os); OutputUtil.writeAsAscii("--", os); } }