*/
public void writeOut(OutputStream out) throws IOException {
// byte intbuf[] = new byte[LittleEndianConsts.INT_SIZE];
// byte shortbuf[] = new byte[LittleEndianConsts.SHORT_SIZE];
@SuppressWarnings("resource")
LittleEndianOutputStream leosOut = new LittleEndianOutputStream(out);
switch (mode) {
case parsed: {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
LittleEndianOutputStream leos = new LittleEndianOutputStream(bos);
// total size, will be determined later ..
leos.writeShort(getFlags1());
leos.write(getLabel().getBytes(ISO1));
leos.write(0);
leos.write(getFileName().getBytes(ISO1));
leos.write(0);
leos.writeShort(getFlags2());
leos.writeShort(getUnknown1());
leos.writeInt(getCommand().length() + 1);
leos.write(getCommand().getBytes(ISO1));
leos.write(0);
leos.writeInt(getDataSize());
leos.write(getDataBuffer());
leos.writeShort(getFlags3());
leos.close(); // satisfy compiler ...
leosOut.writeInt(bos.size()); // total size
bos.writeTo(out);
break;
}