@Override public void write (final int b) throws IOException { m_aBAOS.write (b); }
private void writeObject (@Nonnull final ObjectOutputStream aOOS) throws IOException { // write text aOOS.writeObject (m_sText); // write the mime body final NonBlockingByteArrayOutputStream aBAOS = new NonBlockingByteArrayOutputStream (); try { if (m_aData != null) { aBAOS.write (1); m_aData.writeTo (aBAOS); } else { aBAOS.write (0); } aBAOS.writeTo (aOOS); } catch (final MessagingException ex) { throw new IOException ("Messaging exception", ex); } finally { StreamHelper.close (aBAOS); } } }
@Override public void write (final byte [] b) throws IOException { m_aBAOS.write (b); }
@Override public void write (final byte [] b, final int off, final int len) throws IOException { m_aBAOS.write (b, off, len); } }
@Override public void write (final int b) throws IOException { MockHttpServletResponse.this.m_aContent.write (b); super.flush (); _setCommittedIfBufferSizeExceeded (); }
private void writeObject (@Nonnull final ObjectOutputStream aOOS) throws IOException { // write the mime body // Write to BAOS first to avoid serializing an incomplete object try (final NonBlockingByteArrayOutputStream aBAOS = new NonBlockingByteArrayOutputStream ()) { try { if (m_aData != null) { aBAOS.write (1); m_aData.writeTo (aBAOS); } else { aBAOS.write (0); } } catch (final MessagingException ex) { throw new IOException ("Messaging exception: " + ex.getMessage ()); } aOOS.write (aBAOS.toByteArray ()); } // write the message's MDN aOOS.writeObject (m_aMDN); }
/** * Send a simple HTTP response that only contains the HTTP status code and the * respective descriptive text. An empty header map us used. * * @param aResponseHandler * The response handler to be used. * @param nResponseCode * The HTTP response code to use. * @throws IOException * In case sending fails for whatever reason */ public static void sendSimpleHTTPResponse (@Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnegative final int nResponseCode) throws IOException { try (final NonBlockingByteArrayOutputStream aData = new NonBlockingByteArrayOutputStream ()) { final String sHTTPLine = Integer.toString (nResponseCode) + " " + CHttp.getHttpResponseMessage (nResponseCode) + CHttp.EOL; aData.write (sHTTPLine.getBytes (CHttp.HTTP_CHARSET)); aResponseHandler.sendHttpResponse (nResponseCode, new HttpHeaderMap (), aData); } }
else nHeaderSepIndex = 0; aBAOS.write (b);