barn.gif barnhead.gif

The com.javaranch.common package

This is a collection of classes that I use for a variety of projects I work on. You are welcome to use any of these yourself.

view the javadoc

get all the source and class files in one jar file (you might need to right click and select "save link as...")

Class Description  
AWT Contains a collection of static methods related to GUI's (AWT only). Includes a method for drawing a really nice beveled rectangle and some GridBagConstraints shortcuts. Java Doc
ByteVector Like the Vector object, except rather than tracking dynamic array of pointers to different objects, this is simply a dynamic array of bytes.

The advantage is speed and memory savings.

Java Doc
CRC A class that makes it easier to create CRC codes. Java Doc
DPoint A very lean serialized point type where X and Y are of type double. Java Doc
ErrorLog ErrorLog is a simple way of handling warnings and errors in your programs.

Rather than having 20 lines of error handling for each occurance of an error, you can have just one. When the time comes to handle your errors a different way, you don't have to find a thousand error locations and rewrite the handling: just change the ErrorLog initialization
Java Doc
Files Contains a collection of static methods related to files. Includes:

  • File to array and array to file shortcuts.
  • Methods to get directory listings with angle brackets around subdirectories and date/time/filesize information for files.
  • Shortcut methods for writing an object to a file and reading an object from a file.
Java Doc
GDate Gregorian Date - stored as Year, Month and Day. Not very memory efficient, but good for converting to strings, or quickly extracting the day of the month.

See the complimentary class JDate for memory efficiency or doing date math.
Java Doc
GUI Adds some static Swing related methods to AWT. Java Doc
HTTP This class simplifies the exchange of objects with Servlets via the HTTP protocol.

This class is usually used by Applets, but it can also be used by applications and other servlets.
Java Doc
IPoint A very lean serialized point type where X and Y are of type int. Java Doc
IRect A very lean serialized rectangle type made of ints. Java Doc
JDate Date is tracked as an integer. Fast, small and excellent for date math.

This class will behave as both a Julian date and a Gregorian date although the actual date will be stored as a single integer.
Java Doc
LogServlet Used for tracking events in a Servlet.

Log messages are sent to a logging object that defaults to being turned off. Activating the servlet via a web browser gives you access to activate logging for debugging purposes.

I use this for all of my servlets now.
Java Doc
Numbers Contains a collection of static methods related to Numbers. Includes endian conversion and range testing. Java Doc
ObjectServlet Used for passing objects back and forth between applets and servlets. Java Doc
Servlets This class simplifies the exchange of objects between clients and Servlets via the HTTP protocol.

The server-side methods in this class interact with the client-side methods in com.javaranch.common.HTTP.
Java Doc
Str A robust string processing class.

The Java String and StringBuffer classes are final. So it is not possible to inherit all of the functionality of one of those classes and enhance it with a few more methods.

This class attempts to provide all of the functionality found in both String and StringBuffer, plus provide a wide collection of additional functionality.
Java Doc
Structures A collection of static methods related to data structures including sub array retrieval. Java Doc
TextFileIn Since TextFileIn extends BufferedReader and adds nothing more than a convenient constructor, all other member functions are identical to BufferedReader. Java Doc
TextFileOut A convenience class for writing text files. Java Doc
Time Contains a collection of static methods related to Time. Including a delay method that does not throw any exceptions. Java Doc