Skip to content

Commit

Permalink
add typesize
Browse files Browse the repository at this point in the history
  • Loading branch information
normanrz committed Nov 20, 2024
1 parent 010ec28 commit d77e823
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public class BloscCompression implements DefaultBlockReader, DefaultBlockWriter,
@CompressionParameter
private final int blocksize;

@CompressionParameter
private final int typesize;

@CompressionParameter
private int nthreads;

Expand Down Expand Up @@ -93,6 +96,12 @@ public int getBlocksize() {
return blocksize;
}

public int getTypesize() {

return typesize;
}



public int getNthreads() {

Expand All @@ -112,6 +121,7 @@ public BloscCompression() {
this.clevel = 6;
this.shuffle = NOSHUFFLE;
this.blocksize = 0; // auto
this.typesize = 1;
this.nthreads = 1;
}

Expand All @@ -120,21 +130,34 @@ public BloscCompression(
final int clevel,
final int shuffle,
final int blocksize,
final int typesize,
final int nthreads) {

this.cname = cname;
this.clevel = clevel;
this.shuffle = shuffle;
this.blocksize = blocksize;
this.typesize = typesize;
this.nthreads = nthreads;
}

public BloscCompression(
final String cname,
final int clevel,
final int shuffle,
final int blocksize,
final int nthreads) {

this(cname, clevel, shuffle, blocksize, 1, nthreads);
}

public BloscCompression(final BloscCompression template) {

this.cname = template.cname;
this.clevel = template.clevel;
this.shuffle = template.shuffle;
this.blocksize = template.blocksize;
this.typesize = template.typesize;
this.nthreads = template.nthreads;
}

Expand Down Expand Up @@ -164,7 +187,7 @@ public <T> void write(

final ByteBuffer src = dataBlock.toByteBuffer();
final ByteBuffer dst = ByteBuffer.allocate(src.limit() + JBlosc.OVERHEAD);
JBlosc.compressCtx(clevel, shuffle, 1, src, src.limit(), dst, dst.limit(), cname, blocksize, nthreads);
JBlosc.compressCtx(clevel, shuffle, typesize, src, src.limit(), dst, dst.limit(), cname, blocksize, nthreads);
final BufferSizes sizes = blosc.cbufferSizes(dst);
final int dstSize = (int)sizes.getCbytes();
out.write(dst.array(), 0, dstSize);
Expand Down

0 comments on commit d77e823

Please sign in to comment.