What is the "general contract" of a method

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?

Jon Skeet
people
quotationmark

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 the writeBoolean method of interface DataOutput.

So you should expect DataInputStream.readBoolean to behave that way.

people

See more on this question at Stackoverflow