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