From 3fa725fa20324b3cf385bc3458ee514e4d7cdd35 Mon Sep 17 00:00:00 2001 From: Doug Felt Date: Wed, 12 May 2004 05:33:44 +0000 Subject: [PATCH] ICU-3743 split icu4j api data gathering from report generation X-SVN-Rev: 15271 --- .../src/com/ibm/icu/dev/tool/docs/GatherAPIData.java | 12 ++++++++++-- icu4j/src/com/ibm/icu/dev/tool/docs/README.txt | 11 ++++++++--- icu4j/src/com/ibm/icu/dev/tool/docs/ReportAPI.java | 3 +++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/icu4j/src/com/ibm/icu/dev/tool/docs/GatherAPIData.java b/icu4j/src/com/ibm/icu/dev/tool/docs/GatherAPIData.java index 13ac0204529..71f71114c30 100644 --- a/icu4j/src/com/ibm/icu/dev/tool/docs/GatherAPIData.java +++ b/icu4j/src/com/ibm/icu/dev/tool/docs/GatherAPIData.java @@ -30,8 +30,8 @@ * -sourcepath c:/doug/cvsproj/icu4j/src * -name "ICU4J 3.0" * -output icu4j30.api - * -zip - * com.ibm.icu.text + * -gzip + * com.ibm.icu.lang com.ibm.icu.math com.ibm.icu.text com.ibm.icu.util * * todo: separate generation of data files (which requires taglet) from * comparison and report generation (which does not require it) @@ -47,6 +47,7 @@ package com.ibm.icu.dev.tool.docs; import com.sun.javadoc.*; import java.io.*; import java.util.*; +import java.util.zip.GZIPOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -58,6 +59,7 @@ public class GatherAPIData { String base; // strip this prefix String filter; // filter classes by name boolean zip; + boolean gzip; public static int optionLength(String option) { if (option.equals("-name")) { @@ -70,6 +72,8 @@ public class GatherAPIData { return 2; } else if (option.equals("-zip")) { return 1; + } else if (option.equals("-gzip")) { + return 1; } return 0; } @@ -94,6 +98,8 @@ public class GatherAPIData { this.filter = options[i][1]; } else if (opt.equals("-zip")) { this.zip = true; + } else if (opt.equals("-gzip")) { + this.gzip = true; } } @@ -110,6 +116,8 @@ public class GatherAPIData { ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(output + ".zip")); zos.putNextEntry(new ZipEntry(output)); os = zos; + } else if (gzip) { + os = new GZIPOutputStream(new FileOutputStream(output + ".gz")); } else { os = new FileOutputStream(output); } diff --git a/icu4j/src/com/ibm/icu/dev/tool/docs/README.txt b/icu4j/src/com/ibm/icu/dev/tool/docs/README.txt index e289b4dd1c1..75a4c730778 100644 --- a/icu4j/src/com/ibm/icu/dev/tool/docs/README.txt +++ b/icu4j/src/com/ibm/icu/dev/tool/docs/README.txt @@ -13,8 +13,8 @@ generate a file listing information about the public API, including the ICU4J status (draft, stable, deprecated, obsolete). It excludes private API, API marked @internal. The file is written as text, so it is human-readable, but it is a bit verbose. To save space, the file -can be zip'd (NOTE: to become gzip'd), which will reduce the size by -about a factor of 10. +can be zip'd or gzip'd (using flags passed to the tool), which will +reduce the size by about a factor of 10. GatherAPIData requires javadoc and is currently based on sun jdk 1.4.2. JavaDoc is internal (I believe) so you need a reference jvm @@ -56,6 +56,11 @@ ReportAPI can generate either plain text or html reports. Since it only requires the data files and does not rely on JavaDoc, it is more straightforward to invoke. +ReportAPI uses the file extension to determine how to uncompress the +api data files. It expects '.zip' for files that have been compressed +using zip, and '.gz' for files that have been compressed using gzip. +The GatherAPIData utility automatically appends these extensions when +compression is used. API Data Files @@ -84,4 +89,4 @@ fields, the 'signature' is the type of the field. For methods, the For more information, please see APIInfo.java. -------- \ No newline at end of file +------- diff --git a/icu4j/src/com/ibm/icu/dev/tool/docs/ReportAPI.java b/icu4j/src/com/ibm/icu/dev/tool/docs/ReportAPI.java index d44b5ea6cd9..5e6c8bab5b0 100644 --- a/icu4j/src/com/ibm/icu/dev/tool/docs/ReportAPI.java +++ b/icu4j/src/com/ibm/icu/dev/tool/docs/ReportAPI.java @@ -74,6 +74,9 @@ public class ReportAPI { } else { File f = new File(fileName); is = new FileInputStream(f); + if (fileName.endsWith(".gz")) { + is = new GZIPInputStream(is); + } } InputStreamReader isr = new InputStreamReader(is); return read(new BufferedReader(isr));