[]
        
(Showing Draft Content)

CSJ2K.j2k.codestream.writer.CodestreamWriter

CodestreamWriter Class

This is the abstract class for writing to a codestream. A codestream corresponds to headers (main and tile-parts) and packets. Each packet has a head and a body. The codestream always has a maximum number of bytes that can be written to it. After that many number of bytes no more data is written to the codestream but the number of bytes is counted so that the value returned by getMaxAvailableBytes() is negative. If the number of bytes is unlimited a ridicoulosly large value, such as Integer.MAX_VALUE, is equivalent.

       <p>Data writting to the codestream can be simulated. In this case, no byto
       is effectively written to the codestream but the resulting number of bytes
       is calculated and returned (although it is not accounted in the bit
       stream). This can be used in rate control loops.</p><p>Implementing classes should write the header of the bit stream before
       writing any packets. The bit stream header can be written with the help of
       the HeaderEncoder class.</p>
Inheritance
CodestreamWriter
Namespace: CSJ2K.j2k.codestream.writer
Assembly: C1.WPF.PdfViewer.4.6.2.dll
Syntax
public abstract class CodestreamWriter

Constructors

Name Description
CodestreamWriter(int)

Allocates this object and initializes the maximum number of bytes.

Fields

Name Description
maxBytes

The maximum number of bytes that can be written to the bit stream

ndata

The number of bytes already written to the bit stream

Properties

Name Description
Length

Returns the current length of the entire codestream.

MaxAvailableBytes

Returns the number of bytes remaining available in the codestream. This is the maximum allowed number of bytes minus the number of bytes that have already been written to the bit stream. If more bytes have been written to the bit stream than the maximum number of allowed bytes, then a negative value is returned.

OffLastROIPkt

Gives the offset of the end of last packet containing ROI information

Methods

Name Description
close()

Closes the underlying resource (file, stream, network connection, etc.). After a CodestreamWriter is closed no more data can be written to it.

commitBitstreamHeader(HeaderEncoder)

Writes the header data to the bit stream, if it has not been already done. In some implementations this method can be called only once, and an IllegalArgumentException is thrown if called more than once.

writePacketBody(byte[], int, bool, bool, int)

Writes a packet body to the codestream and returns the number of bytes used by this body. If in simulation mode then no data is written to the bit stream but the number of bytes is calculated. This can be used for iterative rate allocation.

       <p>If the number of bytes that has to be written to the codestream is
       more than the space left (as returned by getMaxAvailableBytes()), only
       the data that does not exceed the allowed length is effectively written
       and the rest is discarded. However the value returned by the method is
       the total length of the packet, as if all of it was written to the bit
       stream.</p>
writePacketHead(byte[], int, bool, bool, bool)

See Also