static byte[] toByteArray(ByteArrayOutputStream baos) { ret baos == null ? null : baos.toByteArray(); } static byte[] toByteArray(Iterator it) { new ByteBuffer buf; while (it.hasNext()) buf.add((byte) it.next().intValue()); ret buf.toByteArray(); } static byte[] toByteArray(O o) { if (o == null) null; if (o cast byte[]) ret o; if (o instanceof Iterator) ret toByteArray((Iterator) o); // not sure what else to put here fail("toByteArray", o); }