[PRIVATE] Return some infomation about the data subset so that it's easier to parse later
Object
subset
:
can be a typedArray or a complex object
Object
:
reconstruction info about this subset
Set a boolean to secify if data should be compressed or not
Boolean
b
:
true to compress, false to not compress
Get the output
Object
:
the output, or null
reset inputs and inputs
Launch the encoding of the block
Specify an input to the encoder
Object
obj
:
an object candidate, containing a _data and _metadata attributes
[STATIC] Give in what case we fall when we want to use this data. Cases are described at the top
Whatever
data
:
a piec of data, object, array, typed array...
Number
:
the case
Check if the given object is a good intput candidate
Object
obj
:
an object candidate, containing a _data and _metadata attributes
Boolean
:
true if good candidate, false if not
Get the array type based on byte stream info. The returned object can be used as a constructor
Function
:
constructor of a typed array
Get the output
Object
:
the output, or null
reset inputs and inputs
Specify an input
ArrayBuffer
buff
:
the arraybuffer that contains some data to be deserialized
A PixBinDecoder instance decodes a *.pixp file and output an Image2D or Image3D.
The input, specified by .addInput(...)
must be an ArrayBuffer
(from an UrlToArrayBufferFilter
, an UrlToArrayBufferReader
or anothrer source ).
Usage
#_parseIndex
[PRIVATE]
[PRIVATE]
#enableBlockVerification(b)
Specify wether or not the bin decoder must perform a checksum verification for each block to be decoded.
Specify wether or not the bin decoder must perform a checksum verification for each block to be decoded.
Boolean
b
:
true to perfom verification, false to skip it (default: false)
#fetchBlock(n, forceDecoding)
Fetch a block at the given index. The first time it called on a block,
this block will be read from the stream and decoded.
If a block is already decoded, it will be retrieved as is without trying to
re-decode it, unless forceDecoding
is true
.
Fetch a block at the given index. The first time it called on a block,
this block will be read from the stream and decoded.
If a block is already decoded, it will be retrieved as is without trying to
re-decode it, unless forceDecoding
is true
.
Number
n
:
the index of the block to fetch
Boolean
forceDecoding
:
force the decoding even though it was already decoded
Object
:
the decoded block, containing _data_
, _metadata
and originalBlockType
#getBinCreationDate
Get the creation date of the file in the ISO8601 format
Get the creation date of the file in the ISO8601 format
String
:
the data
#getBinDescription
Get the description of the PixBin file
Get the description of the PixBin file
String
:
the description
#getBinUserObject
The userObject is a generic container added to the PixBin. It can carry all sorts of data. If not specified during encoding, it's null.
The userObject is a generic container added to the PixBin. It can carry all sorts of data. If not specified during encoding, it's null.
Object
:
the userObject
#getNumberOfBlocks
Get the number of blocks encoded in this PixBin file
Get the number of blocks encoded in this PixBin file
Number
#getOutput
Get the the decoded output
Get the the decoded output
Object
:
a decoded object
#isValid
To be called after setInput. Tells if the buffer loaded is valid or not.
To be called after setInput. Tells if the buffer loaded is valid or not.
Boolean
:
true if valid, false if not.
#reset
reset I/O and data to query
reset I/O and data to query
#setInput(buff)
Specify an input
Specify an input
ArrayBuffer
buff
:
the input
A PixBinEncoder instance takes an Image2D or Image3D as input with addInput(...)
and encode it so that it can be saved as a *.pixp file.
An output filename can be specified using .setMetadata("filename", "yourName.pixp");
,
by default, the name is "untitled.pixp".
When update()
is called, a gzip blog is prepared as output[0] and can then be downloaded
when calling the method .download()
. The gzip blob could also be sent over AJAX
using a third party library.
Usage
.MAGIC_NUMBER
[static] the first sequence of bytes for a pixbin file is this ASCII string
[static] the first sequence of bytes for a pixbin file is this ASCII string
#addInput(obj)
Add an input. Multiple inputs can be added.
Add an input. Multiple inputs can be added.
Object
obj
:
an object that comtain _data and _metadata
#enableDataCompression(b)
Set a boolean to secify if data should be compressed or not
Set a boolean to secify if data should be compressed or not
Boolean
b
:
true to compress, false to not compress
#getOutput
Get the output
Get the output
ArrayBuffer
:
the encoded data as a buffer
#reset
[PRIVATE] reset inputs and inputs
[PRIVATE] reset inputs and inputs
#run
Launch the encoding
Launch the encoding
#setOption(optionName, value)
Overwrite one of the default options.
Overwrite one of the default options.
String
optionName
:
one of "madeWith" (default: "pixbincodec_js"), "userObject" (default: null), "description" (default: null)