Skip to content

Commit

Permalink
Merge pull request #48 from Intel-HLS/pv_updates
Browse files Browse the repository at this point in the history
fix API issues
  • Loading branch information
pnvaidya authored Feb 24, 2017
2 parents e3187f8 + d7290fa commit d4f0a10
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/intel/gkl/compression/IntelDeflater.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public IntelDeflater(int level, boolean nowrap) {
this.level = level;
this.nowrap = nowrap;
strategy = DEFAULT_STRATEGY;

}

/**
Expand Down Expand Up @@ -135,6 +136,7 @@ public void reset() {
*/
@Override
public void setInput(byte[] b, int off, int len) throws NullPointerException {
if(lz_stream == 0) reset();
if(b == null) {
throw new NullPointerException("Input is null");
}
Expand All @@ -144,8 +146,6 @@ public void setInput(byte[] b, int off, int len) throws NullPointerException {

inputBuffer = b;
inputBufferLength = len;


}

/**
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/com/intel/gkl/compression/IntelInflater.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public synchronized boolean load(File tempDir) {
public IntelInflater(boolean nowrap) {
// initFieldsNative();
this.nowrap = nowrap;

}

/**
Expand Down Expand Up @@ -116,6 +117,7 @@ public void reset() {
*/
@Override
public void setInput(byte[] b, int off, int len) throws NullPointerException {
if(lz_stream == 0) reset();
if(b == null) {
throw new NullPointerException("Input is null");
}
Expand All @@ -125,6 +127,7 @@ public void setInput(byte[] b, int off, int len) throws NullPointerException {
inputBuffer = b;
inputBufferOffset = off;
inputBufferLength = len;

}

/**
Expand Down Expand Up @@ -152,7 +155,7 @@ public int inflate (byte[] b, int off, int len ) {
*/
@Override
public int inflate (byte[] b ) {
return inflateNative( b, 0, 0);
return inflateNative( b, 0, b.length);
}

/**
Expand All @@ -175,6 +178,15 @@ public boolean finished() {
*/
@Override
public void end() {
endNative();

if(lz_stream !=0)
{
endNative();
lz_stream=0;
}
}

@Override
protected void finalize() {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public void randomDNATest() {


randomDNA(input);
deflater.reset();
deflater.setInput(input, 0, input.length);
deflater.finish();

Expand All @@ -98,7 +97,7 @@ public void randomDNATest() {


try {
inflater.reset();

inflater.setInput(compressed, 0, compressedBytes);
final long start = System.currentTimeMillis();
inflater.inflate(result, 0, LEN);
Expand Down

0 comments on commit d4f0a10

Please sign in to comment.