@Test public void testWriteTo() throws Exception { final Serializable serializableObj = new SerializableObject(); final SerializableEntity httpentity = new SerializableEntity(serializableObj, null); final ByteArrayOutputStream out = new ByteArrayOutputStream(); httpentity.writeTo(out); final byte[] bytes = out.toByteArray(); Assert.assertNotNull(bytes); final ObjectInputStream oin = new ObjectInputStream(new ByteArrayInputStream( bytes)); final SerializableObject serIn = (SerializableObject) oin.readObject(); Assert.assertEquals(4, serIn.intValue); Assert.assertEquals("Hello", serIn.stringValue); try { httpentity.writeTo(null); Assert.fail("NullPointerException should have been thrown"); } catch (final NullPointerException ex) { } }
@Override public final void writeTo(final OutputStream outStream) throws IOException { Args.notNull(outStream, "Output stream"); final ObjectOutputStream out = new ObjectOutputStream(outStream); out.writeObject(this.serializable); out.flush(); }
SerializableEntity extends AbstractHttpEntity { @Override public final void writeTo(final OutputStream outStream) throws IOException { Args.notNull(outStream, "Output stream"); final ObjectOutputStream out = new ObjectOutputStream(outStream); out.writeObject(this.serializable); out.flush(); } }
SerializableEntity extends AbstractHttpEntity { @Override public final void writeTo(final OutputStream outStream) throws IOException { Args.notNull(outStream, "Output stream"); final ObjectOutputStream out = new ObjectOutputStream(outStream); out.writeObject(this.serializable); out.flush(); } SerializableEntity(
            final Serializable serializable, final ContentType contentType, final String contentEncoding);  SerializableEntity(final Serializable serializable, final ContentType contentType); }
SerializableEntity extends AbstractHttpEntity { @Override public final void writeTo(final OutputStream outStream) throws IOException { Args.notNull(outStream, "Output stream"); final ObjectOutputStream out = new ObjectOutputStream(outStream); out.writeObject(this.serializable); out.flush(); } SerializableEntity(
            final Serializable serializable, final ContentType contentType, final String contentEncoding);  SerializableEntity(final Serializable serializable, final ContentType contentType); @Override final InputStream getContent(); @Override final long getContentLength(); @Override final boolean isRepeatable(); @Override final boolean isStreaming(); @Override final void writeTo(final OutputStream outStream); @Override final void close(); }
SerializableEntity extends AbstractHttpEntity { @Override public final void writeTo(final OutputStream outStream) throws IOException { Args.notNull(outStream, "Output stream"); final ObjectOutputStream out = new ObjectOutputStream(outStream); out.writeObject(this.serializable); out.flush(); } SerializableEntity(
            final Serializable serializable, final ContentType contentType, final String contentEncoding);  SerializableEntity(final Serializable serializable, final ContentType contentType); @Override final InputStream getContent(); @Override final long getContentLength(); @Override final boolean isRepeatable(); @Override final boolean isStreaming(); @Override final void writeTo(final OutputStream outStream); @Override final void close();  }