* simplified certain scripting use-cases

This commit is contained in:
Reinhard Pointner 2012-07-04 10:22:41 +00:00
parent 811f945daf
commit e535b692ff
3 changed files with 10 additions and 1 deletions

View File

@ -2,6 +2,14 @@
-Dapplication.deployment=msi
-Dapplication.dir="%APPDATA%\FileBot"
# FileBot system properties
-DthreadPool=8
-Dunixfs=false
# proxy settings
# -Dhttp.proxyHost=localhost
# -Dhttp.proxyPort=8888
# memory settings
-Xms64m
-Xmx512m

View File

@ -66,6 +66,7 @@ URL.metaClass.getHtml = { new XmlParser(new org.cyberneko.html.parsers.SAXParser
URL.metaClass.fetch = { fetch(delegate) }
ByteBuffer.metaClass.getText = { csn = "utf-8" -> Charset.forName(csn).decode(delegate.duplicate()).toString() }
ByteBuffer.metaClass.getHtml = { csn = "utf-8" -> new XmlParser(new org.cyberneko.html.parsers.SAXParser()).parseText(delegate.getText(csn)) }
String.metaClass.getHtml = { new XmlParser(new org.cyberneko.html.parsers.SAXParser()).parseText(delegate) }
URL.metaClass.get = { delegate.getText() }
URL.metaClass.post = { Map parameters -> post(delegate.openConnection(), parameters) }

View File

@ -39,7 +39,7 @@ String.metaClass.pad = Number.metaClass.pad = { length = 2, padding = "0" -> del
/**
* Return a substring matching the given pattern or break.
*/
String.metaClass.match = { String pattern -> def matcher = delegate =~ pattern; if (matcher.find()) return matcher[0] else throw new Exception("Match failed") }
String.metaClass.match = { String pattern, int matchGroup = 0 -> def matcher = delegate =~ pattern; if (matcher.find()) return matcher.group(matchGroup) else throw new Exception("Match failed") }
/**