Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-685

LineReader to implement AutoCloseable

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.9.0
    • Component/s: Utilities
    • Labels:
      None

      Description

      org.apache.commons.io.LineReader should implement the AutoCloseable interface in order to allow the use of try-with-resources statement such as in the following example:

      try (final LineIterator itr = new LineIterator(new FileReader("c:/temp/readme.txt"))) {
        while (itr.hasNext()) {
          System.out.println(itr.next());
          }
      }

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              andrear Andrea Rombaldi
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 5m
                5m
                Remaining:
                Remaining Estimate - 5m
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified