List of utility methods to do OutputStream Write
void | serializeInt(int i, DataOutputStream dout) serialize Int dout.writeInt(i); |
void | serializeInt(OutputStream out, Integer data) serialize Int try { int v = ((Integer) data).intValue(); out.write((byte) ((v >>> 24) & 0xFF)); out.write((byte) ((v >>> 16) & 0xFF)); out.write((byte) ((v >>> 8) & 0xFF)); out.write((byte) ((v >>> 0) & 0xFF)); } catch (IOException ex) { ex.printStackTrace(); ... |
void | serializeNull(DataOutputStream dout) serialize Null serializeHeaderString(tagNull, dout); serializeTrailerString(tagNull, dout); |
void | serializeObject(OutputStream out, Object o) serialize Object ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(o);
|
void | serializeShortLE(short value, OutputStream outStream) Converts a short to a little-endian byte representation and writes it to the given stream. outStream.write((byte) (value & 0xFF)); outStream.write((byte) ((value >> 8) & 0xFF)); |
void | serializeSpecial(OutputStream os, Serializable obj) serialize Special ObjectOutputStream oos = new ObjectOutputStream(os);
oos.writeObject(obj);
|
void | serializeString(OutputStream out, String data) serialize String byte[] byteData = data.getBytes(); serializeInt(out, byteData.length); try { out.write(byteData); } catch (IOException e) { e.printStackTrace(); |
void | serializeString(String str, DataOutputStream dout) serialize String if (str == null) serializeNull(dout); else { serializeHeaderString(tagString, dout); dout.writeUTF(str); serializeTrailerString(tagString, dout); |
void | serializeTo(OutputStream outputStream, Object obj) serialize To String json = GSON.toJson(obj); try { outputStream.write(json.getBytes()); outputStream.flush(); } finally { if (outputStream != null) { outputStream.close(); |
void | serializeToOutputStream(final Serializable ser, final OutputStream os) Serialize to output stream. ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(os); oos.writeObject(ser); oos.flush(); } finally { oos.close(); |