accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Medinets <david.medin...@gmail.com>
Subject Do Outer Input Streams Need to be Closed?
Date Sat, 17 Nov 2012 05:04:56 GMT
I've seen a lot of Java code that looks like this example from
org.apache.accumulo.core.client.admin.TableOperationsImpl. Does the
BufferedReader need to be closed or it is automatically closed when
the ZipInputStream is closed?

    ZipInputStream zis = new ZipInputStream(fs.open(path));
    try {
      ZipEntry zipEntry;
      while ((zipEntry = zis.getNextEntry()) != null) {
        if (zipEntry.getName().equals(Constants.EXPORT_TABLE_CONFIG_FILE)) {
          BufferedReader in = new BufferedReader(new InputStreamReader(zis));
          String line;
          while ((line = in.readLine()) != null) {
            String sa[] = line.split("=", 2);
            props.put(sa[0], sa[1]);
          }

          break;
        }
      }
    } finally {
      zis.close();
    }

Mime
View raw message