// FlatDecode is compatible with the java.util.zip.Deflater class
os.write("/Filter /FlateDecode\n".getBytes());
os.write("/Length ".getBytes());
os.write(Integer.toString(b.size()+1).getBytes());
os.write("\n>>\nstream\n".getBytes());
b.writeTo(os);
os.write("\n".getBytes());
} else {
// This is a non-deflated stream
os.write("/Length ".getBytes());
os.write(Integer.toString(buf.size()).getBytes());