/** * <p> Reads <code>body-data</code> from the current * <code>encapsulation</code> and discards it. * * <p>Use this method to skip encapsulations you don't need or don't * understand. * * @return The amount of data discarded. * * @throws MalformedStreamException if the stream ends unexpectedly. * @throws IOException if an i/o error occurs. */ public int discardBodyData() throws MalformedStreamException, IOException { return readBodyData(null); }
/** * <p> Reads <code>body-data</code> from the current * <code>encapsulation</code> and discards it. * * <p>Use this method to skip encapsulations you don't need or don't * understand. * * @return The amount of data discarded. * * @throws MalformedStreamException if the stream ends unexpectedly. * @throws IOException if an i/o error occurs. */ public int discardBodyData() throws MalformedStreamException, IOException { return readBodyData(null); }
/** * <p> Reads <code>body-data</code> from the current * <code>encapsulation</code> and discards it. * * <p>Use this method to skip encapsulations you don't need or don't * understand. * * @return The amount of data discarded. * * @throws MalformedStreamException if the stream ends unexpectedly. * @throws IOException if an i/o error occurs. */ public int discardBodyData() throws MalformedStreamException, IOException { return readBodyData(null); }
/** * <p> Reads <code>body-data</code> from the current * <code>encapsulation</code> and discards it. * * <p>Use this method to skip encapsulations you don't need or don't * understand. * * @return The amount of data discarded. * * @throws MalformedStreamException if the stream ends unexpectedly. * @throws IOException if an i/o error occurs. */ public int discardBodyData() throws MalformedStreamException, IOException { return readBodyData(null); }
/** * <p> Reads <code>body-data</code> from the current * <code>encapsulation</code> and discards it. * * <p>Use this method to skip encapsulations you don't need or don't * understand. * * @return The amount of data discarded. * * @throws MalformedStreamException if the stream ends unexpectedly. * @throws IOException if an i/o error occurs. */ public int discardBodyData() throws MalformedStreamException, IOException { return readBodyData(null); }
/** * <p> Reads <code>body-data</code> from the current * <code>encapsulation</code> and discards it. * * <p>Use this method to skip encapsulations you don't need or don't * understand. * * @return The amount of data discarded. * * @throws MalformedStreamException if the stream ends unexpectedly. * @throws IOException if an i/o error occurs. */ public int discardBodyData() throws MalformedStreamException, IOException { return readBodyData(null); }
/** * <p> Reads <code>body-data</code> from the current * <code>encapsulation</code> and discards it. * * <p>Use this method to skip encapsulations you don't need or don't * understand. * * @return The amount of data discarded. * * @throws MalformedStreamException if the stream ends unexpectedly. * @throws IOException if an i/o error occurs. */ public int discardBodyData() throws MalformedStreamException, IOException { return readBodyData(null); }
byte[] bodyarr = toByteArr(response.getEntity().getContent()); byte[] boundary = "*************boundary>>****************".getBytes(); ByteArrayInputStream bis = new ByteArrayInputStream(bodyarr); MultipartStream stream; stream = new MultipartStream(bis,boundary); boolean hasNextPart = stream.skipPreamble(); while (hasNextPart) { String header=stream.readHeaders(); String name = getNameFromHeader(header); //if data is image FileOutputStream outputStream = new FileOutputStream(name+".png"); stream.readBodyData(outputStream); hasNextPart = stream.readBoundary(); }
System.out.println(header); System.out.println("Body:"); multipartStream.readBodyData(System.out); System.out.println(""); nextPart = multipartStream.readBoundary();
try multi.readBodyData(os); try multi.readBodyData(os); try multi.readBodyData(os);