class PdfArray {
/**
* Writes the PDF representation of this <CODE>PdfArray</CODE> as an array
* of <CODE>byte</CODE> to the specified <CODE>OutputStream</CODE>.
*
* @param writer for backwards compatibility
* @param os the <CODE>OutputStream</CODE> to write the bytes to.
*/
@Override
public void toPdf(final PdfWriter writer, final OutputStream os) throws IOException {
os.write('[');
Iterator<PdfObject> i = arrayList.iterator();
PdfObject object;
int type = 0;
if (i.hasNext()) {
object = i.next();
if (object == null)
object = PdfNull.PDFNULL;
object.toPdf(writer, os);
}
while (i.hasNext()) {
object = i.next();
if (object == null)
object = PdfNull.PDFNULL;
type = object.type();
if (type != PdfObject.ARRAY && type != PdfObject.DICTIONARY && type != PdfObject.NAME && type != PdfObject.STRING)
os.write(' ');
object.toPdf(writer, os);
}
os.write(']');
}
}