Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/RevlogCompressor.java @ 628:6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 22 May 2013 15:52:31 +0200 |
parents | 7c0d2ce340b8 |
children |
comparison
equal
deleted
inserted
replaced
627:5153eb73b18d | 628:6526d8adbc0f |
---|---|
18 | 18 |
19 import java.util.zip.Deflater; | 19 import java.util.zip.Deflater; |
20 | 20 |
21 import org.tmatesoft.hg.core.HgIOException; | 21 import org.tmatesoft.hg.core.HgIOException; |
22 import org.tmatesoft.hg.core.SessionContext; | 22 import org.tmatesoft.hg.core.SessionContext; |
23 import org.tmatesoft.hg.repo.HgRuntimeException; | |
23 import org.tmatesoft.hg.util.LogFacility.Severity; | 24 import org.tmatesoft.hg.util.LogFacility.Severity; |
24 | 25 |
25 /** | 26 /** |
26 * | 27 * |
27 * @author Artem Tikhomirov | 28 * @author Artem Tikhomirov |
42 sourceData = source; | 43 sourceData = source; |
43 compressedLen = -1; | 44 compressedLen = -1; |
44 } | 45 } |
45 | 46 |
46 // out stream is not closed! | 47 // out stream is not closed! |
47 public int writeCompressedData(DataSerializer out) throws HgIOException { | 48 public int writeCompressedData(DataSerializer out) throws HgIOException, HgRuntimeException { |
48 zip.reset(); | 49 zip.reset(); |
49 DeflaterDataSerializer dds = new DeflaterDataSerializer(out, zip, sourceData.serializeLength()); | 50 DeflaterDataSerializer dds = new DeflaterDataSerializer(out, zip, sourceData.serializeLength()); |
50 sourceData.serialize(dds); | 51 sourceData.serialize(dds); |
51 dds.finish(); | 52 dds.finish(); |
52 return zip.getTotalOut(); | 53 return zip.getTotalOut(); |
53 } | 54 } |
54 | 55 |
55 public int getCompressedLength() { | 56 public int getCompressedLength() throws HgRuntimeException { |
56 if (compressedLen != -1) { | 57 if (compressedLen != -1) { |
57 return compressedLen; | 58 return compressedLen; |
58 } | 59 } |
59 Counter counter = new Counter(); | 60 Counter counter = new Counter(); |
60 try { | 61 try { |