Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose typesize as config option #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading