- catch (java.io.IOException e) {
- System.err.println("Exception trying to get readme : " + e.getMessage());
+ catch (IOException e) {
+ errorMessage = e.getMessage();
+ }
+ // Locally-held file failed, so try to find gz file installed on system (eg Debian)
+ try
+ {
+ File gzFile = new File("/usr/share/doc/gpsprune/readme.txt.gz");
+ if (gzFile.exists())
+ {
+ // Copy decompressed bytes from gz file into out
+ InputStream in = new GZIPInputStream(new FileInputStream(gzFile));
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ byte[] buffer = new byte[8 * 1024];
+ int count = 0;
+ do {
+ out.write(buffer, 0, count);
+ count = in.read(buffer, 0, buffer.length);
+ } while (count != -1);
+ out.close();
+ in.close();
+ return out.toString();
+ }
+ }
+ catch (IOException e) {
+ System.err.println("Exception trying to get readme.gz : " + e.getMessage());
+ }
+ // Only show first error message if couldn't get readme from gz either
+ if (errorMessage != null) {
+ System.err.println("Exception trying to get readme: " + errorMessage);