Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/LineReader.java @ 649:e79cf9a8130b
Push: phase4 - update local and remote phase information
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Wed, 26 Jun 2013 20:52:38 +0200 |
| parents | 6526d8adbc0f |
| children | 12a4f60ea972 |
comparison
equal
deleted
inserted
replaced
| 648:690e71d29bf6 | 649:e79cf9a8130b |
|---|---|
| 93 public LineReader ignoreLineComments(String lineStart) { | 93 public LineReader ignoreLineComments(String lineStart) { |
| 94 ignoreThatStarts = lineStart; | 94 ignoreThatStarts = lineStart; |
| 95 return this; | 95 return this; |
| 96 } | 96 } |
| 97 | 97 |
| 98 public <T> void read(LineConsumer<T> consumer, T paramObj) throws HgIOException { | 98 /** |
| 99 * | |
| 100 * @param consumer where to pipe read lines to | |
| 101 * @param paramObj parameterizes consumer | |
| 102 * @return paramObj value for convenience | |
| 103 * @throws HgIOException if there's {@link IOException} while reading file | |
| 104 */ | |
| 105 public <T> T read(LineConsumer<T> consumer, T paramObj) throws HgIOException { | |
| 99 BufferedReader statusFileReader = null; | 106 BufferedReader statusFileReader = null; |
| 100 try { | 107 try { |
| 101 // consumer.begin(file, paramObj); | 108 // consumer.begin(file, paramObj); |
| 102 Reader fileReader; | 109 Reader fileReader; |
| 103 if (encoding == null) { | 110 if (encoding == null) { |
| 117 } | 124 } |
| 118 if (!skipEmpty || line.length() > 0) { | 125 if (!skipEmpty || line.length() > 0) { |
| 119 ok = consumer.consume(line, paramObj); | 126 ok = consumer.consume(line, paramObj); |
| 120 } | 127 } |
| 121 } | 128 } |
| 129 return paramObj; | |
| 122 } catch (IOException ex) { | 130 } catch (IOException ex) { |
| 123 throw new HgIOException(ex.getMessage(), ex, file); | 131 throw new HgIOException(ex.getMessage(), ex, file); |
| 124 } finally { | 132 } finally { |
| 125 new FileUtils(log).closeQuietly(statusFileReader); | 133 new FileUtils(log).closeQuietly(statusFileReader); |
| 126 // try { | 134 // try { |
