Commit 3949a69
ReadData and DataBlockCodec (#137)
* Add N5ReadBenchmark
* remove redundant modifiers
* WIP: remove @OverRide annotations for ByteBuffer methods
to be able to turn those methods on/off in the DataBlock interface
without causing compile errors in the implementations.
* Fix benchmark image URL
* Add byte[] DataType.createSerializeArray(numElements)
* WIP Compression / Codec API
* WIP encode/decode implementations
* bugfix
* cleanup
* wip
* feat: DataBlock methods to read/write directly from DataInput/Output
* WIP: SplittableReadData
* WIP DataBlock readData variants
* WIP SplittableReadData
* WIP clean up Compression interface
* WIP speed up DataBlock.readData(InputStream), and clean up
* WIP DataBlock.writeData(OutputStream)
* WIP use Splittable.ReadData in DefaultBlockReader
* WIP revise StringDataBlock (doesn't work yet)
* WIP revise StringDataBlock
revert to holding serialized and actual data. otherwise we can't be
compatible with existing N5 datasets.
* Add ByteOrder to DataBlock.writeData()
* Clean up
* Clean up
* fix javadoc error
* switch from byte[] to ByteBuffer for DataBlock.de/serialize()
* Add explicit commons-io dependency
* Lean more on ReadData
* Move ReadData etc to separate classes
* Add ReadData.writeTo(OutputStream)
* Add EncodedReadData that wraps a ReadData and an OutputStreamEncoder
* Compression (BytesCodec) can encode ReadData. (This might happen
immediately or later when the ReadData is written to OutputStream).
* WIP ReadData.decode(Codec)
* Add decode(ReadData readData) variant that knows the length of the decoded data
* Hide ReadData implementations, use static ReadData factory methods instead
* Remove deprecated BlockWriter/BlockReader interfaces
* Clean up
* javacod
* Remove old Compression methods. Everything goes through ReadData
* Remove DataBlock de/serialize() methods
Maybe we'll rename readData()/writeData() later, the point is to remove
the ByteBuffer methods from the API
* fix javadoc error
* Add ReadData method toByteBuffer()
* clean up
* Use OutputStream wrapper to intercept close() in EncodedReadData
We still need a custom interface "OutputStreamOperator" because we want
to throw IOException and UnaryOperator::apply doesn't.
* ReadData.encode/decode methods forwarding to BytesCodec
* remove BytesCodec interface and put encode/decode into Compression for now
* idea
* Add LazyReadData and OutputStreamWriter
When data is requested from the LazyReadData, the LazyReadData will ask
its OutputStreamWriter to write the data to a ByteArrayOutputStream.
When the LazyReadData itself is written to an OutputStream, it will pass
that OutputStream to its OutputStreamWriter (without loading the data
into a byte[] array first).
* WIP Codecs
* WIP Codecs
* WIP Codecs
* WIP use Codecs, remove serialization methods from DataBlock
* Use ProxyOutputStream. FilterOutputStream is slow
* use only array type in DataBlockCodec generics
* refactor
* refactor
* convenience DataCodec methods to get codec with approprioate endianness
* typo
* refactor
* refactor
* Let DatasetAttributes provide the DataBlockCodec
avoids the Compression argument to encode/decode methods
* refactor, add ReadData.materialize()
This is in preparation for moving SplittableReadData into a separate PR
* Remove SplittableReadData interface
* fix javadoc error
* rename ChunkHeader to BlockHeader
* Remove unnecessary flush()s, instead close OutputStream where it is constructed
* Refactor for compatibility with upcoming Codecs Release (#2)
* refactor: don't pass `decodedLength` to ReadData
* refactor: move DataBlockFactory/DataBlockCodecFactory to N5Codecs
* feat: Add StringDataCodec, ObjectDataCodec, StringDataBlockCodec, ObjectDataBlockCodec
DataCodecs now creat the access object and return it during `deserialize`
* refactor: add AbstractDataBlock to extract shared logic between Default/String/Object blocks
* refactor: DatasetAttributes responsible for DataBlockCodec creation
N5BlockCodec uses dataType (and potentially other DatasetAttributes to wrap the desired DataBlockCodec
* revert: add back createDataBlock logic in DataType
* doc: retain javadoc from before refactor
* revert: keep protected constructor with DataBlockCodec parameter
refactor: inline createDataBlockCodec from constructor params
* refactor: remove currently unused N5BlockCodec. Something like this may be needed when multiple codecs are supported
* refactor: dont expose N5Codecs internals
* refactor: rename encodeBlockHeader -> createBlockHeader
* feat: add ZarrStringDataCodec support
* ZarrStringDataCodec always LITTLE_ENDIAN
* fix javadoc
* clean up visibility and formatting
* bugfix
* improve readability
---------
Co-authored-by: John Bogovic <bogovicj@janelia.hhmi.org>
Co-authored-by: Caleb Hulbert <cmhulbert@users.noreply.github.com>1 parent 7724ced commit 3949a69
File tree
35 files changed
+1542
-601
lines changed- src
- main/java/org/janelia/saalfeldlab/n5
- codec
- readdata
- test/java/org/janelia/saalfeldlab/n5
35 files changed
+1542
-601
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
205 | 221 | | |
206 | 222 | | |
207 | 223 | | |
| |||
Lines changed: 19 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | | - | |
39 | | - | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| 54 | + | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
| |||
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
66 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 1 addition & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 32 | + | |
54 | 33 | | |
55 | 34 | | |
Lines changed: 11 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
| 33 | + | |
35 | 34 | | |
36 | 35 | | |
37 | | - | |
| 36 | + | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| |||
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 54 | + | |
68 | 55 | | |
69 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
70 | 60 | | |
71 | 61 | | |
72 | 62 | | |
73 | | - | |
| 63 | + | |
74 | 64 | | |
75 | | - | |
| 65 | + | |
76 | 66 | | |
77 | 67 | | |
78 | 68 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 69 | + | |
| 70 | + | |
85 | 71 | | |
86 | | - | |
87 | 72 | | |
Lines changed: 41 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | | - | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | | - | |
| 65 | + | |
65 | 66 | | |
66 | | - | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
76 | 111 | | |
77 | | - | |
78 | | - | |
| 112 | + | |
0 commit comments