I'm looking at the the java docs for DataInputStream
here: http://docs.oracle.com/javase/7/docs/api/java/io/DataInputStream.html
I'm looking to see what its methods do so I look at the descriptions of readBoolean()
, readByte()
, readChar()
etc.
The descriptions are all something along the lines of:
See the general contract of the readBoolean method of DataInput.
And in the extended explanation.
public final boolean readBoolean()
throws IOException
See the general contract of the readBoolean method of DataInput.
Bytes for this operation are read from the contained input stream.
Specified by:
readBoolean in interface DataInput
Returns:
the boolean value read.
Throws:
EOFException - if this input stream has reached the end.
IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
See Also:
FilterInputStream.in
Where can I "see" the general contracts of these methods and what is a general contract of a method?
It just means that the documentation of DataInput.readBoolean
contains more detail. In particular, that documentation states:
Reads one input byte and returns
true
if that byte is nonzero,false
if that byte is zero. This method is suitable for reading the byte written by thewriteBoolean
method of interfaceDataOutput
.
So you should expect DataInputStream.readBoolean
to behave that way.
A general contract of a method in a base class is one that must be the basis of the contracts of the method in all extending classes. It is general in that it applies generally to the whole genre of the base class and all its derived classes. Regardless of other terms derived classes may add to the method's contract, it must always keep the general contract.
An explicit general contract is one that's given in the method documentation for the base class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With