+ catch (IOException e) {
+ errorMessage = e.getMessage();
+ }
+ finally {
+ try {in.close();} catch (Exception e) {}
+ }
+ if (readme != null) {return readme;}
+
+ // 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
+ 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();
+ readme = out.toString();
+ }
+ }
+ catch (IOException e) {
+ System.err.println("Exception trying to get readme.gz : " + e.getMessage());
+ }
+ finally {
+ try {in.close();} catch (Exception e) {}
+ }
+ if (readme != null) {return readme;}
+ // 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);