1 16 17 20 21 package org.apache.axis.attachments; 22 23 24 25 26 27 30 31 public final class DimeMultiPart { 32 static final long transSize = Integer.MAX_VALUE; 33 static final byte CURRENT_VERSION = 1; protected java.util.Vector parts = new java.util.Vector (); 35 public DimeMultiPart() {} 36 public void addBodyPart(DimeBodyPart part) { 37 parts.add(part); 38 } 39 40 public void write(java.io.OutputStream os) 41 throws java.io.IOException { 42 int size = parts.size(); 43 int last = size - 1; 44 45 for (int i = 0; i < size; ++i) 46 ((DimeBodyPart) parts.elementAt(i)).write(os, 47 (byte) ((i == 0 ? DimeBodyPart.POSITION_FIRST : 48 (byte) 0) 49 | (i == last ? DimeBodyPart.POSITION_LAST : 50 (byte) 0)), transSize); 51 } 52 53 public long getTransmissionSize() { 54 long size = 0; 55 56 for (int i = parts.size() - 1; i > -1; --i) 57 size += 58 ((DimeBodyPart) parts.elementAt(i)).getTransmissionSize( 59 transSize); 60 61 return size; 62 } 63 } 64 | Popular Tags |