• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is It possible to find the whole syntax of an API method online ?  RSS feed

 
Nikolas Nikolaou
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I was trying to find the complete readLine() method In the online docs but all I can get hold of Is:

readLine
public String readLine()
throws IOException
Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.
Returns:A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reachedThrows:IOException - If an I/O error occursSee Also:Files.readAllLines(java.nio.file.Path, java.nio.charset.Charset)


Is It possible to view the actual method syntax online ?
 
Campbell Ritchie
Marshal
Posts: 56581
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I presume that is in the BufferedReader class.
That is what the writers of the class wanted you to know. You therefore do not need to know anything else.

Explore your Java® installation folder and you should find a file called src.zip. Unzip that and you can find the code for most classes: look in the java folder, then the io folder.
 
Nikolas Nikolaou
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks !
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is what the writers of the class wanted you to know. You therefore do not need to know anything else.

I disagree with the "therefore" reasoning. There are a number of places where the JRE javadocs leave out crucial details that are needed to make good use of said classes - in which case "[the source|Google|JavaRanch] is your friend" applies. From the absence of information in the javadocs I wouldn't infer the nonexistence of useful additional information.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:I disagree with the "therefore" reasoning....

Me too, but I agree with Campbell's general point: you don't need to know - and certainly shouldn't rely on - how a class works in order to use it, because next release someone might rip out the guts and make it work totally differently. And leaving out irrelevant information is often a hallmark of good documentation.

It's a pity that programmers aren't taught to document as well as they're taught how to design and code. The world would be a much better place

Winston
 
Campbell Ritchie
Marshal
Posts: 56581
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree with Winston (it does happen occasionally ‍). The reason for sparse documentation may be to permit changes in future versions. If you document a particular algorithm, you may be stuck with it for ever.

Ulf is right: i have erred on the side of being too dogmatic there.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!