This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Way to SEARCH the APIs ?

 
bob connolly
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!

Is there a way to do a complete text search on the JAVA APIs?

ie: JavaTM 2 Platform, Standard Edition, v 1.4.2
API Specification

In other words, if i'm trying to find something in a comment area or trying to find every single reference to byte[], no matter where it's located, is there such a way?

I know that i can copy 1 particular class html to a text file and do a search on that, so maybe there's a way to copy the whole API document to a text file and do a search?

Thanks alot for any ideas!

bc
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The J2SE Javadoc is online here.

You could use the Google toolbar to search the site. Is that what you want?

Jules
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
something like this?

Search Sun API docs for byte[]
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To search for a method-name (including constructors) I wrote a shell script find_java_method.sh which has to be invoked with the name of the method, i.e.:

Feel free to adapt it to your needs.
Grep and especially sed aren't standard-tools on the win-plattforms, but freely available.

And this is find_java_method.sed, to remove html-tags from output:


[ August 06, 2004: Message edited by: Stefan Wagner ]

[ August 06, 2004: Message edited by: Stefan Wagner ]
[ August 06, 2004: Message edited by: Stefan Wagner ]
 
bob connolly
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well for instance, right now i'm trying to find out how to handle HEX values and don't have an idea which class to use, so i'd like to do a complete search on the API to find every reference to the HEX word in the API listing!

I may get back alot of finds, but i can probably get an idea which classes to go and check into!

Thanks again!
bc
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So if you don't have grep get it.


-i: ignore Case
-R: recursive

will return every token containing some kind of 'Hex', including 'TouchExpand...'.
This will be problematic, if your search contains some html-token, included in every java-page.
But in the other cases it will do a fast and easy rough impression.

If you use sed, you may clean up the output as shown above.

My results:

[ August 09, 2004: Message edited by: Stefan Wagner ]
[ August 09, 2004: Message edited by: Stefan Wagner ]
 
bob connolly
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stefan!

This is exactly what i'm looking for!

I looked too complex initially, but now i understand what your doing!

This will get me alot more creative for sure!

I'm still mystified why the regular APIs dont' have such a capability!

Take care Stefan, das is good!
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sun does provide this search page for developers but it's not as useful as it could be as I can't see an easy way to isolate one set of API docs. D'oh! :roll:

Jules
 
bob connolly
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works great Stefan!

I downloaded grep, very easy to run and it's free!

This is what i've been looking for YEARS! and i'm going to write a script to process the output, but absolutely ASTONISHED! this capability is not in the JAVADOC search!

The follwoing command printed out the file names and number of "finds" per file:

C:\UNZIPPED DOWNLOADS\JAVADOC 1.5\docs\api\java>grep -iSc hex *

.\lang\Integer.html:16
.\lang\InternalError.html:0
.\lang\InterruptedException.html:0
.\lang\Iterable.html:0
.\lang\LinkageError.html:0
.\lang\Long.html:16
.\lang\Math.html:0
........

And this command gets the actual text:

C:\UNZIPPED DOWNLOADS\JAVADOC 1.5\docs\api\java>grep -iS hex *

.\lang\Integer.html:<META NAME="keywords" CONTENT="toHexString()">
.\lang\Integer.html:<TD><CODE><B><A HREF="../../java/lang/Integer.html#toHexStr
ng(int)">toHexString</A></B>(int i)</CODE>
.\lang\Integer.html: the digits for hexadecimal (radix 16) are
.\lang\Integer.html:<A NAME="toHexString(int)"><!-- --></A><H3>
.\lang\Integer.html:toHexString</H3>
.\lang\Integer.html ublic static <A HREF="../../java/lang/String.html" title="
lass in java.lang">String</A> <B>toHexString</B>(int i)</PRE>
.\lang\Integer.html: in hexadecimal (base 16) with no extra leading
.\lang\Integer.html: hexadecimal digits:
.\lang\Integer.html: Integer.toHexString(n).toUpperCase()
.\lang\Integer.html: represented by the argument in hexadecimal (base&
bsp;16).<DT><B>Since:</B></DT>
.\lang\Integer.html: hexadecimal integer exactly as by the method
.\lang\Integer.html: Accepts decimal, hexadecimal, and octal numbers given
.\lang\Integer.html: <dd><i>Sign<sub>opt</sub></i> <code>0x</code> <i>HexDigits
/i>
.\lang\Integer.html: <dd><i>Sign<sub>opt</sub></i> <code>0X</code> <i>HexDigits
/i>
.\lang\Integer.html: <dd><i>Sign<sub>opt</sub></i> <code>#</code> <i>HexDigits<
i>
.\lang\Integer.html: <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigit
</i>
.\lang\Long.html:<META NAME="keywords" CONTENT="toHexString()">
.\lang\Long.html:<TD><CODE><B><A HREF="../../java/lang/Long.html#toHexString(lo
g)">toHexString</A></B>(long i)</CODE>
.\lang\Long.html: the digits for hexadecimal (radix 16) are
.\lang\Long.html:<A NAME="toHexString(long)"><!-- --></A><H3>
.\lang\Long.html:toHexString</H3>
.\lang\Long.html ublic static <A HREF="../../java/lang/String.html" title="cla
s in java.lang">String</A> <B>toHexString</B>(long i)</PRE>
.\lang\Long.html: ASCII digits in hexadecimal (base 16) with no extra
.\lang\Long.html: hexadecimal digits:
.\lang\Long.html: Long.toHexString(n).toUpperCase()
.\lang\Long.html: value represented by the argument in hexadecim
l
.\lang\Long.html: Accepts decimal, hexadecimal, and octal numbers given by the
.\lang\Long.html: <dd><i>Sign<sub>opt</sub></i> <code>0x</code> <i>HexDigits</i

.\lang\Long.html: <dd><i>Sign<sub>opt</sub></i> <code>0X</code> <i>HexDigits</i

.\lang\Long.html: <dd><i>Sign<sub>opt</sub></i> <code>#</code> <i>HexDigits</i>
.\lang\Long.html: <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</
>
.\lang\Long.html: a minus sign, then the rest of it is parsed as a hexadecimal
nteger
.\lang\Object.html: the unsigned hexadecimal representation of the hash code of
the
.\lang\Object.html: getClass().getName() + '@' + Integer.toHexString(hashCode()

.\lang\RuntimeException.html:<DT><B>Direct Known Subclasses:</B> <DD><A HREF=".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic