diff src/org/tmatesoft/hg/internal/DeflaterDataSerializer.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
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/DeflaterDataSerializer.java	Wed May 15 20:10:09 2013 +0200
+++ b/src/org/tmatesoft/hg/internal/DeflaterDataSerializer.java	Thu May 16 19:46:13 2013 +0200
@@ -16,10 +16,11 @@
  */
 package org.tmatesoft.hg.internal;
 
-import java.io.IOException;
 import java.util.zip.Deflater;
 import java.util.zip.DeflaterOutputStream;
 
+import org.tmatesoft.hg.core.HgIOException;
+
 /**
  * {@link DeflaterOutputStream} counterpart for {@link DataSerializer} API
  * 
@@ -43,7 +44,7 @@
 	}
 
 	@Override
-	public void writeInt(int... values) throws IOException {
+	public void writeInt(int... values) throws HgIOException {
 		for (int i = 0; i < values.length; i+= AUX_BUFFER_CAPACITY) {
 			int idx = 0;
 			for (int j = i, x = Math.min(values.length, i + AUX_BUFFER_CAPACITY); j < x; j++) {
@@ -58,7 +59,7 @@
 	}
 
 	@Override
-	public void write(byte[] data, int offset, int length) throws IOException {
+	public void write(byte[] data, int offset, int length) throws HgIOException {
 		// @see DeflaterOutputStream#write(byte[], int, int)
 		int stride = deflateOutBuffer.length;
 		for (int i = 0; i < length; i += stride) {
@@ -66,7 +67,7 @@
 		}
 	}
 	
-	private void internalWrite(byte[] data, int offset, int length) throws IOException {
+	private void internalWrite(byte[] data, int offset, int length) throws HgIOException {
 		deflater.setInput(data, offset, length);
 		while (!deflater.needsInput()) {
 			deflate();
@@ -74,11 +75,11 @@
 	}
 
 	@Override
-	public void done() {
+	public void done() throws HgIOException {
 		delegate.done();
 	}
 
-	public void finish() throws IOException {
+	public void finish() throws HgIOException {
 		if (!deflater.finished()) {
 			deflater.finish();
 			while (!deflater.finished()) {
@@ -87,7 +88,7 @@
 		}
 	}
 
-	protected void deflate() throws IOException {
+	protected void deflate() throws HgIOException {
 		int len = deflater.deflate(deflateOutBuffer, 0, deflateOutBuffer.length);
 		if (len > 0) {
 			delegate.write(deflateOutBuffer, 0, len);