Skip to content

Instantly share code, notes, and snippets.

@chanwit
Created May 3, 2010 07:28
Show Gist options
  • Select an option

  • Save chanwit/387845 to your computer and use it in GitHub Desktop.

Select an option

Save chanwit/387845 to your computer and use it in GitHub Desktop.
import groovy.util.*
import java.net.*
class HomeController {
def index = {
//
// read input via NekoHTML
//
def p = new XmlParser( new org.cyberneko.html.parsers.SAXParser() )
//
// connect to InfoQ
// then parse
//
def root = p.parse("http://infoq.com")
//
// next is to store output
//
def ba = new ByteArrayOutputStream()
ba.withObjectOutputStream { out ->
out << root
}
def bytes = ba.toByteArray()
render "${bytes.size()}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment