Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/InflaterDataAccess.java @ 423:9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 23 Mar 2012 22:51:18 +0100 |
parents | fdd7d756dea0 |
children | 2a08466838d3 |
comparison
equal
deleted
inserted
replaced
422:5d1cc7366d04 | 423:9c9c442b5f2e |
---|---|
19 import java.io.EOFException; | 19 import java.io.EOFException; |
20 import java.io.IOException; | 20 import java.io.IOException; |
21 import java.util.zip.DataFormatException; | 21 import java.util.zip.DataFormatException; |
22 import java.util.zip.Inflater; | 22 import java.util.zip.Inflater; |
23 import java.util.zip.ZipException; | 23 import java.util.zip.ZipException; |
24 | |
25 import org.tmatesoft.hg.core.HgBadStateException; | |
26 | |
27 | 24 |
28 /** | 25 /** |
29 * DataAccess counterpart for InflaterInputStream. | 26 * DataAccess counterpart for InflaterInputStream. |
30 * XXX is it really needed to be subclass of FilterDataAccess? | 27 * XXX is it really needed to be subclass of FilterDataAccess? |
31 * | 28 * |
97 try { | 94 try { |
98 while (!inflater.needsInput()) { | 95 while (!inflater.needsInput()) { |
99 c += inflater.inflate(dummy, 0, dummy.length); | 96 c += inflater.inflate(dummy, 0, dummy.length); |
100 } | 97 } |
101 } catch (DataFormatException ex) { | 98 } catch (DataFormatException ex) { |
102 throw new HgBadStateException(ex); | 99 throw new IOException(ex); |
103 } | 100 } |
104 } | 101 } |
105 decompressedLength = c + oldPos; | 102 decompressedLength = c + oldPos; |
106 reset(); | 103 reset(); |
107 seek(oldPos); | 104 seek(oldPos); |