@Nonnull private static NonBlockingByteArrayInputStream _getCachedInputStream (@Nonnull @WillClose final InputStream aIS) { return new NonBlockingByteArrayInputStream (StreamHelper.getAllBytes (aIS)); }
@Nullable public byte [] getContent (@Nonnull final DataSource aDS) throws IOException { return StreamHelper.getAllBytes (StreamHelper.getBuffered (aDS.getInputStream ())); }
@Nonnull private static Document _readXML (@Nonnull final InputStream aRequestIS) { if (isDebug ()) { final byte [] aBytes = StreamHelper.getAllBytes (aRequestIS); final Charset aCharset = Charset.defaultCharset (); LOGGER.info ("GOT[" + aCharset.name () + "]:\n" + new String (aBytes, aCharset)); return DOMReader.readXMLDOM (aBytes); } return DOMReader.readXMLDOM (aRequestIS); }
public CachingTransformStreamSource (@Nonnull @WillClose final InputStream aIS, @Nullable final String sSystemID) { super (new NonBlockingByteArrayInputStream (StreamHelper.getAllBytes (aIS)), sSystemID); }
private void _addResolvablePublicId (@Nonnull @Nonempty final String sPublicID, @Nonnull @Nonempty final String sFilePath) { if (m_aResolveMap.containsKey (sPublicID)) throw new IllegalArgumentException ("Passed public id '" + sPublicID + "' is already contained!"); final InputStream aIS = ClassPathResource.getInputStream (sFilePath); if (aIS == null) throw new IllegalArgumentException ("The passed resource " + sFilePath + " does not exist!"); final byte [] aBytes = StreamHelper.getAllBytes (aIS); m_aResolveMap.put (sPublicID, aBytes); }
public String getContent () { try { String sNormalizedContent; if (m_aParameterMap.isEmpty ()) { m_aContent = StreamHelper.getAllBytes (m_aDelegate.getInputStream ()); sNormalizedContent = new String (m_aContent, _getCharset ()); } else { sNormalizedContent = _getContentFromParameterMap (m_aParameterMap); m_aContent = sNormalizedContent.getBytes (_getCharset ()); } return StringHelper.hasNoText (sNormalizedContent) ? "[EMPTY]" : sNormalizedContent; } catch (final IOException e) { throw new IllegalStateException (e); } }
/** * Set the content of the {@link InputStream} as a payload. No charset is * applied and therefore no content type starting with "text/" may be used. * * @param aIS * {@link InputStream} to read the content from. Never * <code>null</code>. * @param aCharset * Charset to use. If it is <code>null</code> the content is set as a * byte array, if not <code>null</code> the content is set as a String. * @return this */ @Nonnull public AS2ClientRequest setData (@Nonnull @WillClose final InputStream aIS, @Nullable final Charset aCharset) { ValueEnforcer.notNull (aIS, "InputStream"); final byte [] aBytes = StreamHelper.getAllBytes (aIS); if (aCharset == null) { // Set pure byte array return setData (aBytes); } // Convert to String and remember charset return setData (new String (aBytes, aCharset), aCharset); }
final byte [] aBytes = StreamHelper.getAllBytes (aHttpRequest.getInputStream ());
aData = StreamHelper.getAllBytes (aChunkedIS); aMsg.headers ().setContentLength (aData.length);
final byte [] aResponseBytes = StreamHelper.getAllBytes (aEntity.getContent ()); if (ArrayHelper.isEmpty (aResponseBytes)) throw new SMPClientBadResponseException ("Could not read SMP server response content");
@Nonnull public IMicroElement convertToMicroElement (@Nonnull final EmailAttachment aAttachment, @Nullable final String sNamespaceURI, @Nonnull final String sTagName) { final IMicroElement eAttachment = new MicroElement (sNamespaceURI, sTagName); eAttachment.setAttribute (ATTR_FILENAME, aAttachment.getFilename ()); if (aAttachment.hasCharset ()) eAttachment.setAttribute (ATTR_CHARSET, aAttachment.getCharset ().name ()); eAttachment.setAttribute (ATTR_DISPOSITION, aAttachment.getDisposition ().getID ()); eAttachment.setAttribute (ATTR_CONTENT_TYPE, aAttachment.getContentType ()); // Base64 encode final byte [] aBytes = StreamHelper.getAllBytes (aAttachment.getInputStream ()); if (aBytes != null) eAttachment.appendText (Base64.encodeBytes (aBytes)); return eAttachment; }
aMsgData = StreamHelper.getAllBytes (aHttpRequest.getInputStream ());
aResponseHandler, aMsg); aData = StreamHelper.getAllBytes (aDataSourceBody.getInputStream ());
final byte [] aData = StreamHelper.getAllBytes (aEntity.getContent ());
try eAttachment.appendText (Base64.encodeBytes (StreamHelper.getAllBytes (aDS.getInputStream ())));