Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
This project has been moved to BitBucket.org: https://bitbucket.org/kentcdodds/java-helper-library/overview The Java Helper Library is library of classes containing helpful methods I've found useful. I'm constantly developing on it because I'm constantly finding helpful things I use all the time when I code. I would love input from anyone who finds something that could be improved. Please let me know if you find this useful (it would really make my day). I'm super open to people contributing to this project. Please feel free to e-mail me at firstname.lastname@example.org. Thanks. Notable helpful classes/methods: -IOHelper: This has Methods which make it easy to make sure a filename is filename safe (doesn't include illegal characters). There are methods to copy a resource to a file, file to a file, get the byte array of a file, get the file or resource into a String, zipping and unzipping files (in memory as well), and much more! It leverages the HelperFile to handle files in memory, so if you have files you don't want to actually save to disk, but would still like to treat as files, this can be a great help. -EmailHelper: sendEmail(service, username, password, email) is really helpful for sending e-mails with minimal code. The model package has helper classes like Email and HelperFile which allow you to send attachments even if the file itself is in memory. Support for Google, Yahoo, and Windows Live email sessions as well as the option of giving your own session with sendEmail(session, email). -StringHelper: Lots of helpful methods for manipulating strings. Have you wanted to shorten a string and add the "..." somewhere in the middle? What about wrapping a bunch of text by adding a newline after a given number of characters? Or, one of my favorites, have you wanted to split an array or list of words by a comma? It's so annoying, but this makes it really easy! Take a look. It's really helpful. -SwingHelper: Helpful methods dealing with Swing components. Center a window, resize an image, easily call a file opener/saver or a folder chooser for user interaction, work with JOptionPanes easily, and even get a window of an image (helpful for progress wheels). -NumberHelper: Ever needed to check whether input from a user is a valid number? This helper has a helpful method for that. It also helps with rounding, getting a percentage, and cleaning a number string of all non-numeric characters. -DateHelper: Difference between two dates (absolute and relative) -RandomHelper: This is mostly helpful for debugging purposes. It will generate anything from random names to random MAC addresses. Take a look. There's a lot available. If you think of anything more, let me know with an issue or contribute it yourself. -ReflectionHelper: This is good for looking into your program. You can see if an object has any fields which match a given string or print out the object and it's attributes in a logical way. -OtherHelper: Have two lists and need to remove the contents of one list from the contents of another list? Need to check whether a list or array has any null values? These methods have yet to be classified, so they're still in the OtherHelper class, but they have proven to be helpful for me. -PrinterHelper: This is helpful for debugging. Basically, the way it works is instead of Systm.out.println(), you use PrinterHelper.print() and it will only print if you've already specified PrinterHelper.setInstancePrint(true) before it's called. There's also a helpful option to open a log window where they will all be printed (this uses code from http://tips4java.wordpress.com/2008/11/08/message-console/) -StringFormatHelper: Helps you format strings like phone numbers, credit cards, and much more. -XMLHelper: Helpful methods for the XML Dom library. Create an XML document out of an xml string, transform a document into an xml string, and create an empty XML document. I'm hoping to develop this a great deal more. I welcome any (kind) input. Important: I'm not a developer with endless years of experience or anything so forgive me if some things are less than perfect. If you find something that falls short of that goal, please submit an issue and I'll look into improving it (or fork this repo and improve it yourself). Thanks! -Kent Dodds