Mercurial > hg4j
diff src/org/tmatesoft/hg/internal/RevlogCompressor.java @ 618:7c0d2ce340b8
Refactor approach how content finds it way down to a commit revision
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 16 May 2013 19:46:13 +0200 |
parents | 243202f1bda5 |
children | 6526d8adbc0f |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/RevlogCompressor.java Wed May 15 20:10:09 2013 +0200 +++ b/src/org/tmatesoft/hg/internal/RevlogCompressor.java Thu May 16 19:46:13 2013 +0200 @@ -16,9 +16,9 @@ */ package org.tmatesoft.hg.internal; -import java.io.IOException; import java.util.zip.Deflater; +import org.tmatesoft.hg.core.HgIOException; import org.tmatesoft.hg.core.SessionContext; import org.tmatesoft.hg.util.LogFacility.Severity; @@ -44,7 +44,7 @@ } // out stream is not closed! - public int writeCompressedData(DataSerializer out) throws IOException { + public int writeCompressedData(DataSerializer out) throws HgIOException { zip.reset(); DeflaterDataSerializer dds = new DeflaterDataSerializer(out, zip, sourceData.serializeLength()); sourceData.serialize(dds); @@ -61,7 +61,7 @@ compressedLen = writeCompressedData(counter); assert counter.totalWritten == compressedLen; return compressedLen; - } catch (IOException ex) { + } catch (HgIOException ex) { // can't happen provided we write to our stream that does nothing but byte counting ctx.getLog().dump(getClass(), Severity.Error, ex, "Failed estimating compressed length of revlog data"); return counter.totalWritten; // use best known value so far @@ -71,15 +71,15 @@ private static class Counter extends DataSerializer { public int totalWritten = 0; - public void writeByte(byte... values) throws IOException { + public void writeByte(byte... values) throws HgIOException { totalWritten += values.length; } - public void writeInt(int... values) throws IOException { + public void writeInt(int... values) throws HgIOException { totalWritten += 4 * values.length; } - public void write(byte[] data, int offset, int length) throws IOException { + public void write(byte[] data, int offset, int length) throws HgIOException { totalWritten += length; } }