1 
2 /*
3  * Hunt - A refined core library for D programming language.
4  *
5  * Copyright (C) 2018-2019 HuntLabs
6  *
7  * Website: https://www.huntlabs.net/
8  *
9  * Licensed under the Apache-2.0 License.
10  *
11  */
12 
13 module hunt.stream.ObjectOutput;
14 
15 /**
16  * ObjectOutput extends the DataOutput interface to include writing of objects.
17  * DataOutput includes methods for output of primitive types, ObjectOutput
18  * extends that interface to include objects, arrays, and Strings.
19  *
20  * @author  unascribed
21  * @see java.io.InputStream
22  * @see java.io.ObjectOutputStream
23  * @see java.io.ObjectInputStream
24  */
25 import hunt.stream.DataOutput;
26 import hunt.util.Common;
27 
28 public interface ObjectOutput : DataOutput, AutoCloseable {
29     /**
30      * Write an object to the underlying storage or stream.  The
31      * class that implements this interface defines how the object is
32      * written.
33      *
34      * @param obj the object to be written
35      * @exception IOException Any of the usual Input/Output related exceptions.
36      */
37     public void writeObject(Object obj)
38       ;
39 
40     /**
41      * Writes a byte. This method will block until the byte is actually
42      * written.
43      * @param b the byte
44      * @exception IOException If an I/O error has occurred.
45      */
46     public void write(int b) ;
47 
48     /**
49      * Writes an array of bytes. This method will block until the bytes
50      * are actually written.
51      * @param b the data to be written
52      * @exception IOException If an I/O error has occurred.
53      */
54     public void write(byte[] b) ;
55 
56     /**
57      * Writes a sub array of bytes.
58      * @param b the data to be written
59      * @param off       the start offset in the data
60      * @param len       the number of bytes that are written
61      * @exception IOException If an I/O error has occurred.
62      */
63     public void write(byte[] b, int off, int len) ;
64 
65     /**
66      * Flushes the stream. This will write any buffered
67      * output bytes.
68      * @exception IOException If an I/O error has occurred.
69      */
70     public void flush() ;
71 
72     /**
73      * Closes the stream. This method must be called
74      * to release any resources associated with the
75      * stream.
76      * @exception IOException If an I/O error has occurred.
77      */
78     public void close() ;
79 }