2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
21 * Defines an interface for classes that allow reading serialized objects.
23 * @see ObjectOutputStream
26 public interface ObjectOutput extends DataOutput {
28 * Closes the target stream. Implementations of this method should free any
29 * resources used by the stream.
32 * if an error occurs while closing the target stream.
34 public void close() throws IOException;
37 * Flushes the target stream. Implementations of this method should ensure
38 * that any pending writes are written out to the target stream.
41 * if an error occurs while flushing the target stream.
43 public void flush() throws IOException;
46 * Writes the entire contents of the byte array {@code buffer} to the output
47 * stream. Blocks until all bytes are written.
50 * the buffer to write.
52 * if an error occurs while writing to the target stream.
54 public void write(byte[] buffer) throws IOException;
57 * Writes {@code count} bytes from the byte array {@code buffer} starting at
58 * position {@code offset} to the target stream. Blocks until all bytes are
62 * the buffer to write.
64 * the index of the first byte in {@code buffer} to write.
66 * the number of bytes from {@code buffer} to write to the target
69 * if an error occurs while writing to the target stream.
71 public void write(byte[] buffer, int offset, int count) throws IOException;
74 * Writes a single byte to the target stream. Only the least significant
75 * byte of the integer {@code value} is written to the stream. Blocks until
76 * the byte is actually written.
81 * if an error occurs while writing to the target stream.
83 public void write(int value) throws IOException;
86 * Writes the specified object {@code obj} to the target stream.
89 * the object to write.
91 * if an error occurs while writing to the target stream.
93 public void writeObject(Object obj) throws IOException;