MCPcopy Index your code
hub / github.com/codenameone/CodenameOne / DataOutputStream

Class DataOutputStream

vm/JavaAPI/src/java/io/DataOutputStream.java:23–370  ·  view source on GitHub ↗

A data output stream lets an application write primitive Java data types to an output stream in a portable way. An application can then use a data input stream to read the data back in. Since: JDK1.0, CLDC 1.0 See Also:DataInputStream

Source from the content-addressed store, hash-verified

21 * Since: JDK1.0, CLDC 1.0 See Also:DataInputStream
22 */
23public class DataOutputStream extends java.io.FilterOutputStream implements java.io.DataOutput{
24 /**
25 * The number of bytes written out so far.
26 */
27 protected int written;
28 byte buff[];
29
30 /**
31 * Constructs a new {@code DataOutputStream} on the {@code OutputStream}
32 * {@code out}. Note that data written by this stream is not in a human
33 * readable form but can be reconstructed by using a {@link DataInputStream}
34 * on the resulting output.
35 *
36 * @param out
37 * the target stream for writing.
38 */
39 public DataOutputStream(OutputStream out) {
40 super(out);
41 buff = new byte[8];
42 }
43
44 /**
45 * Flushes this stream to ensure all pending data is sent out to the target
46 * stream. This implementation then also flushes the target stream.
47 *
48 * @throws IOException
49 * if an error occurs attempting to flush this stream.
50 */
51 @Override
52 public void flush() throws IOException {
53 super.flush();
54 }
55
56 /**
57 * Returns the total number of bytes written to the target stream so far.
58 *
59 * @return the number of bytes written to the target stream.
60 */
61 public final int size() {
62 if (written < 0) {
63 written = Integer.MAX_VALUE;
64 }
65 return written;
66 }
67
68 /**
69 * Writes {@code count} bytes from the byte array {@code buffer} starting at
70 * {@code offset} to the target stream.
71 *
72 * @param buffer
73 * the buffer to write to the target stream.
74 * @param offset
75 * the index of the first byte in {@code buffer} to write.
76 * @param count
77 * the number of bytes from the {@code buffer} to write.
78 * @throws IOException
79 * if an error occurs while writing to the target stream.
80 * @throws NullPointerException

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected