@Override public InputStream getInputStream() throws IOException { LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(); writeTo(bout); return bout.createInputStream(); } @Override
MultiPartDataSource(Message message, DataSource root) { atts = message.getAttachments().iterator(); String s = (String)message.get(Message.CONTENT_TYPE); boundary = findBoundary(s); start = findStart(s); if (!s.contains(boundary)) { s += "; boundary=\"" + boundary + "\""; } contentType = s; rootPart = root; try { writer = new OutputStreamWriter(bout, "ASCII"); writer.append("Content-Type: ").append(contentType).append("\r\n\r\n"); writer.flush(); current = bout.createInputStream(); } catch (Exception e) { //nothing } }
writer.append("Content-ID: <").append(start).append(">\r\n\r\n"); writer.flush(); current = bout.createInputStream(); current = bout.createInputStream();
private void tryRemote(String uriStr) throws IOException { try { LoadingByteArrayOutputStream bout = cache.get(uriStr); url = new URL(uriStr); uri = new URI(url.toString()); if (bout == null) { URLConnection connection = url.openConnection(); is = connection.getInputStream(); bout = new LoadingByteArrayOutputStream(1024); IOUtils.copy(is, bout); is.close(); cache.put(uriStr, bout); } is = bout.createInputStream(); } catch (MalformedURLException | URISyntaxException e) { // do nothing } }
private void tryRemote(String uriStr) throws IOException { try { LoadingByteArrayOutputStream bout = cache.get(uriStr); url = new URL(uriStr); uri = new URI(url.toString()); if (bout == null) { URLConnection connection = url.openConnection(); is = connection.getInputStream(); bout = new LoadingByteArrayOutputStream(1024); IOUtils.copy(is, bout); is.close(); cache.put(uriStr, bout); } is = bout.createInputStream(); } catch (MalformedURLException | URISyntaxException e) { // do nothing } }
@Override public InputStream getInputStream() throws IOException { LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(); writeTo(bout); return bout.createInputStream(); } @Override
public InputStream serialiseAcknowledgment(SequenceAcknowledgement ack) { LoadingByteArrayOutputStream bos = new LoadingByteArrayOutputStream(); try { getContext().createMarshaller().marshal(ack, bos); } catch (JAXBException ex) { throw new RMStoreException(ex); } return bos.createInputStream(); }
/** * Load the InputStream into memory and return a ByteArrayInputStream that * represents it. Closes the in stream. * * @param in * @throws IOException */ public static ByteArrayInputStream loadIntoBAIS(InputStream in) throws IOException { int i = in.available(); if (i < DEFAULT_BUFFER_SIZE) { i = DEFAULT_BUFFER_SIZE; } LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(i); copy(in, bout); in.close(); return bout.createInputStream(); }
/** * Load the InputStream into memory and return a ByteArrayInputStream that * represents it. Closes the in stream. * * @param in * @throws IOException */ public static ByteArrayInputStream loadIntoBAIS(InputStream in) throws IOException { int i = in.available(); if (i < DEFAULT_BUFFER_SIZE) { i = DEFAULT_BUFFER_SIZE; } LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(i); copy(in, bout); in.close(); return bout.createInputStream(); }
/** * Load the InputStream into memory and return a ByteArrayInputStream that * represents it. Closes the in stream. * * @param in * @throws IOException */ public static ByteArrayInputStream loadIntoBAIS(InputStream in) throws IOException { int i = in.available(); if (i < DEFAULT_BUFFER_SIZE) { i = DEFAULT_BUFFER_SIZE; } LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(i); copy(in, bout); in.close(); return bout.createInputStream(); }
/** * Load the InputStream into memory and return a ByteArrayInputStream that * represents it. Closes the in stream. * * @param in * @throws IOException */ public static ByteArrayInputStream loadIntoBAIS(InputStream in) throws IOException { int i = in.available(); if (i < DEFAULT_BUFFER_SIZE) { i = DEFAULT_BUFFER_SIZE; } LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(i); copy(in, bout); in.close(); return bout.createInputStream(); }
/** * Load the InputStream into memory and return a ByteArrayInputStream that * represents it. Closes the in stream. * * @param in * @return * @throws IOException */ public static ByteArrayInputStream loadIntoBAIS(InputStream in) throws IOException { int i = in.available(); if (i < DEFAULT_BUFFER_SIZE) { i = DEFAULT_BUFFER_SIZE; } LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(i); copy(in, bout); in.close(); return bout.createInputStream(); }
MultiPartDataSource(Message message, DataSource root) { atts = message.getAttachments().iterator(); String s = (String)message.get(Message.CONTENT_TYPE); boundary = findBoundary(s); start = findStart(s); if (!s.contains(boundary)) { s += "; boundary=\"" + boundary + "\""; } contentType = s; rootPart = root; try { writer = new OutputStreamWriter(bout, "ASCII"); writer.append("Content-Type: ").append(contentType).append("\r\n\r\n"); writer.flush(); current = bout.createInputStream(); } catch (Exception e) { //nothing } }
public static void convertObjectToSource(Message message) { List<Object> content = CastUtils.cast(message.getContent(List.class)); if (content == null || content.size() < 1) { // nothing to convert return; } // only supporting the wrapped style for now (one pojo <-> one source) Object object = content.get(0); DataWriter<OutputStream> writer = message.getExchange().getService().getDataBinding().createWriter(OutputStream.class); LoadingByteArrayOutputStream bos = new LoadingByteArrayOutputStream(); writer.write(object, bos); content.set(0, new StreamSource(bos.createInputStream())); }
public static void convertObjectToSource(Message message) { List<Object> content = CastUtils.cast(message.getContent(List.class)); if (content == null || content.size() < 1) { // nothing to convert return; } // only supporting the wrapped style for now (one pojo <-> one source) Object object = content.get(0); DataWriter<OutputStream> writer = message.getExchange().getService().getDataBinding().createWriter(OutputStream.class); LoadingByteArrayOutputStream bos = new LoadingByteArrayOutputStream(); writer.write(object, bos); content.set(0, new StreamSource(bos.createInputStream())); }
public void onMessage(Message message) { LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(); try { IOUtils.copy(message.getContent(InputStream.class), bout); message.getExchange().put(InputStream.class, bout.createInputStream()); c.close(message); } catch (IOException e) { //ignore } } });
public void onMessage(Message message) { LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(); try { IOUtils.copy(message.getContent(InputStream.class), bout); message.getExchange().put(InputStream.class, bout.createInputStream()); c.close(message); } catch (IOException e) { //ignore } } });
public void onMessage(Message message) { LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(); try { IOUtils.copy(message.getContent(InputStream.class), bout); message.getExchange().put(InputStream.class, bout.createInputStream()); c.close(message); } catch (IOException e) { //ignore } } });
public void onMessage(Message message) { LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(); try { IOUtils.copy(message.getContent(InputStream.class), bout); message.getExchange().put(InputStream.class, bout.createInputStream()); c.close(message); } catch (IOException e) { //ignore } } });
public void onMessage(Message inMessage) { LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(); try { IOUtils.copy(inMessage.getContent(InputStream.class), bout); inMessage.getExchange().put(InputStream.class, bout.createInputStream()); Map<String, List<String>> inHeaders = (Map<String, List<String>>)inMessage.get(Message.PROTOCOL_HEADERS); inMessage.getExchange().put(Message.PROTOCOL_HEADERS, inHeaders); c.close(inMessage); } catch (IOException e) { //ignore Logger.getLogger(SOAPConnectionImpl.class).trace(e); } } };