From 012153008398ea8fe57c19184d807250b38164a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Sun, 8 Oct 2006 09:57:17 +0000 Subject: [PATCH] Changed readFile to java-based read function to handle \r\n, fixes docs and test, lite still broken --- build/docs/docs.js | 2 +- build/js/writeFile.js | 12 ++++++++++++ build/test/test.js | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/build/docs/docs.js b/build/docs/docs.js index a40f56a2..8f331ea3 100644 --- a/build/docs/docs.js +++ b/build/docs/docs.js @@ -2,7 +2,7 @@ load("build/js/json.js", "build/js/xml.js", "build/js/writeFile.js", "build/js/p var dir = arguments[1]; -var c = parse( readFile(arguments[0]) ); +var c = parse( read(arguments[0]) ); output( c, "docs" ); c = categorize( c ); diff --git a/build/js/writeFile.js b/build/js/writeFile.js index 9e6e008e..43b1eb24 100644 --- a/build/js/writeFile.js +++ b/build/js/writeFile.js @@ -5,3 +5,15 @@ function writeFile( file, stream ) { buffer.print( stream ); buffer.close(); } + +function read( file ) { + var jq = new File(file); + var reader = new BufferedReader(new FileReader(jq)); + var line = null; + var buffer = new java.lang.StringBuffer(jq.length()); + while( (line = reader.readLine()) != null) { + buffer.append(line); + buffer.append("\n"); + } + return buffer.toString(); +} \ No newline at end of file diff --git a/build/test/test.js b/build/test/test.js index 4a6f0c2f..e76b795a 100644 --- a/build/test/test.js +++ b/build/test/test.js @@ -16,7 +16,7 @@ function addTestWrapper(name, test) { } var dir = arguments[1]; -var jq = parse( readFile( arguments[0] ) ); +var jq = parse( read(arguments[0]) ); var testFile = [];