List of utility methods to do DataOutputStream Write Object
void | writeObject(DataOutputStream dos, Object o) write Object ByteArrayOutputStream bout = new ByteArrayOutputStream(20000); try (ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));) { out.writeObject(o); dos.writeInt(bout.size()); dos.write(bout.toByteArray()); dos.flush(); |
void | writeObject(final DataOutputStream out, final Serializable object) write Object if (object == null) { out.writeBoolean(true); } else { out.writeBoolean(false); final ObjectOutputStream oos = new ObjectOutputStream(out); oos.writeObject(object); oos.flush(); oos.close(); ... |
void | writeObjectToStream(Object obj, DataOutputStream data) write Object To Stream Class<? extends Object> objClass = obj.getClass(); if (objClass.equals(Boolean.class)) { data.writeBoolean((Boolean) obj); } else if (objClass.equals(Byte.class)) { data.writeByte((Byte) obj); } else if (objClass.equals(Integer.class)) { data.writeInt((Integer) obj); } else if (objClass.equals(String.class)) { ... |
void | writeObjectToStream(Object obj, DataOutputStream data) write Object To Stream Class objClass = obj.getClass(); if (objClass.equals(Integer.class)) { data.writeInt((Integer) obj); } else if (objClass.equals(String.class)) { data.writeUTF((String) obj); |