Mercurial > hg4j
diff src/org/tmatesoft/hg/internal/InflaterDataAccess.java @ 263:31f67be94e71
RevlogStream - reduce number of object instances, reuse when possible
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 18 Aug 2011 18:06:44 +0200 |
parents | b413b16d10a5 |
children | 856517285256 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/InflaterDataAccess.java Thu Aug 18 03:46:36 2011 +0200 +++ b/src/org/tmatesoft/hg/internal/InflaterDataAccess.java Thu Aug 18 18:06:44 2011 +0200 @@ -41,18 +41,21 @@ private int decompressedLength; public InflaterDataAccess(DataAccess dataAccess, int offset, int compressedLength) { - this(dataAccess, offset, compressedLength, -1, new Inflater(), 512); + this(dataAccess, offset, compressedLength, -1, new Inflater(), new byte[512]); } public InflaterDataAccess(DataAccess dataAccess, int offset, int compressedLength, int actualLength) { - this(dataAccess, offset, compressedLength, actualLength, new Inflater(), 512); + this(dataAccess, offset, compressedLength, actualLength, new Inflater(), new byte[512]); } - public InflaterDataAccess(DataAccess dataAccess, int offset, int compressedLength, int actualLength, Inflater inflater, int bufSize) { + public InflaterDataAccess(DataAccess dataAccess, int offset, int compressedLength, int actualLength, Inflater inflater, byte[] buf) { super(dataAccess, offset, compressedLength); + if (inflater == null || buf == null) { + throw new IllegalArgumentException(); + } this.inflater = inflater; this.decompressedLength = actualLength; - buffer = new byte[bufSize]; + buffer = buf; } @Override