'code-snippet' Category

  • Easy HTML web scraping with Groovy and Java. (w/XOM)

    May 5, 2010

    Ever need to parse some HTML is Java or Groovy? No matter what the source, you’re almost always guaranteed to get bad, unformed garbage as a response when scraping. Rather than ditch XML readers and bust out regex, you can transform this data into good xhtml with tools like TagSoup. The following class is a [...]

  • Copying a file in Java

    February 17, 2010

    Code snippet. Why isn’t this part of the Java API? Just use commons. <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</groupId> <version>1.4</version> </dependency> FileUtils gives us this: public static void copyFile(File srcFile, File destFile) throws IOException

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org