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