tasks a-s

This commit is contained in:
Ingy döt Net 2013-04-10 23:57:08 -07:00
parent 47bf37c096
commit b83f433714
12433 changed files with 156208 additions and 123 deletions

View file

@ -0,0 +1,43 @@
/* NetRexx */
options replace format comments java crossref symbols nobinary
parse arg inFileName .
if inFileName = '' | inFileName = '.' then inFileName = './data/dwarfs.json'
fileContents = slurp(inFileName)
say fileContents
return
-- Slurp a file and return contents as a Rexx string
method slurp(inFileName) public static returns Rexx
slurped = Rexx null
slurpStr = StringBuilder()
ioBuffer = byte[1024]
inBytes = int 0
do
inFile = File(inFileName)
inFileIS = BufferedInputStream(FileInputStream(inFile))
loop label ioLoop until inBytes = -1
slurpStr.append(String(ioBuffer, 0, inBytes))
inBytes = inFileIS.read(ioBuffer)
end ioLoop
catch exFNF = FileNotFoundException
exFNF.printStackTrace
catch exIO = IOException
exIO.printStackTrace
finally
do
inFileIS.close()
catch ex = IOException
ex.printStackTrace
end
end
slurped = Rexx(slurpStr.toString)
return slurped