5353 */
5454package org .janelia .saalfeldlab .n5 .blosc ;
5555
56- import java .io .IOException ;
5756import java .nio .ByteBuffer ;
5857import org .blosc .BufferSizes ;
5958import org .blosc .JBlosc ;
@@ -86,54 +85,56 @@ public class BloscCompression implements Compression {
8685 @ CompressionParameter
8786 private final int blocksize ;
8887
88+ @ CompressionParameter
89+ private final int typesize ;
90+
8991 @ CompressionParameter
9092 private int nthreads ;
9193
9294 private static final transient JBlosc blosc = new JBlosc ();
9395
94-
9596 public String getCname () {
9697
9798 return cname ;
9899 }
99100
100-
101101 public int getClevel () {
102102
103103 return clevel ;
104104 }
105105
106-
107106 public int getShuffle () {
108107
109108 return shuffle ;
110109 }
111110
112-
113111 public int getBlocksize () {
114112
115113 return blocksize ;
116114 }
117115
116+ public int getTypesize () {
117+
118+ return typesize ;
119+ }
118120
119121 public int getNthreads () {
120122
121123 return nthreads ;
122124 }
123125
124-
125126 public void setNthreads (final int nthreads ) {
126127
127128 this .nthreads = nthreads ;
128129 }
129130
130-
131131 public BloscCompression () {
132132
133133 this .cname = "blosclz" ;
134134 this .clevel = 6 ;
135135 this .shuffle = NOSHUFFLE ;
136136 this .blocksize = 0 ; // auto
137+ this .typesize = 1 ;
137138 this .nthreads = 1 ;
138139 }
139140
@@ -142,21 +143,34 @@ public BloscCompression(
142143 final int clevel ,
143144 final int shuffle ,
144145 final int blocksize ,
146+ final int typesize ,
145147 final int nthreads ) {
146148
147149 this .cname = cname ;
148150 this .clevel = clevel ;
149151 this .shuffle = shuffle ;
150152 this .blocksize = blocksize ;
153+ this .typesize = typesize ;
151154 this .nthreads = nthreads ;
152155 }
153156
157+ public BloscCompression (
158+ final String cname ,
159+ final int clevel ,
160+ final int shuffle ,
161+ final int blocksize ,
162+ final int nthreads ) {
163+
164+ this (cname , clevel , shuffle , blocksize , 1 , nthreads );
165+ }
166+
154167 public BloscCompression (final BloscCompression template ) {
155168
156169 this .cname = template .cname ;
157170 this .clevel = template .clevel ;
158171 this .shuffle = template .shuffle ;
159172 this .blocksize = template .blocksize ;
173+ this .typesize = template .typesize ;
160174 this .nthreads = template .nthreads ;
161175 }
162176
@@ -175,12 +189,12 @@ private byte[] decode(final byte[] data, final byte[] dstBuffer) {
175189 }
176190
177191 @ Override
178- public ReadData decode (final ReadData readData ) throws IOException {
192+ public ReadData decode (final ReadData readData ) {
179193 return ReadData .from (decode (readData .allBytes (), null ));
180194 }
181195
182196 @ Override
183- public ReadData encode (final ReadData readData ) throws IOException {
197+ public ReadData encode (final ReadData readData ) {
184198 final byte [] serialized = readData .allBytes ();
185199 final ByteBuffer src = ByteBuffer .wrap (serialized );
186200 final ByteBuffer dst = ByteBuffer .allocate (serialized .length + JBlosc .OVERHEAD );
0 commit comments