C# Класс CSJ2K.j2k.codestream.writer.FileCodestreamWriter

This class implements a CodestreamWriter for Java streams. The streams can be files or network connections, or any other resource that presents itself as a OutputStream. See the CodestreamWriter abstract class for more details on the implementation of the CodestreamWriter abstract class.

Before any packet data is written to the bit stream (even in simulation mode) the complete header should be written otherwise incorrect estimates are given by getMaxAvailableBytes() for rate allocation.

Наследование: CSJ2K.j2k.codestream.writer.CodestreamWriter
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
DEF_BUF_LEN int

Открытые методы

Метод Описание
FileCodestreamWriter ( System os, int mb ) : System

Uses the output stream 'os' for writing the bit stream, using the 'he' header encoder. The magic number is written to the bit stream. Normally, the header encoder must be empty (i.e. no data has been written to it yet). No BufferedOutputStream is used on top of the output stream 'os'.

close ( ) : void

Writes the EOC marker.

commitBitstreamHeader ( HeaderEncoder he ) : void

Writes the header data in the codestream and actualize ndata with the header length. The header is either a MainHeaderEncoder or a TileHeaderEncoder.

writePacketBody ( byte body, int blen, bool sim, bool roiInPkt, int roiLen ) : int

Writes a packet body to the bit stream 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.

If the length of the data that is to be written to the bit stream is more than the space left (as returned by getMaxAvailableBytes()) only the data that does not exceed the allowed length is written, the rest is discarded. However the value returned by the method is the total length of the packet body , as if all of it was written to the bit stream.

writePacketHead ( byte head, int hlen, bool sim, bool sop, bool eph ) : int

Writes a packet head to the bit stream and returns the number of bytes used by this header. It returns the total number of bytes that the packet head takes in the bit stream. 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.

If the length of the data that is to be written to the bit stream is more than the space left (as returned by getMaxAvailableBytes()) only the data that does not exceed the allowed length is written, 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.

If the bit stream header has not been commited yet and 'sim' is false, then the bit stream header is automatically commited (see commitBitstreamHeader() method) before writting the packet.

Приватные методы

Метод Описание
initSOP_EPHArrays ( ) : void

Performs the initialisation of the arrays that are used to store the values used to write SOP and EPH markers

Описание методов

FileCodestreamWriter() публичный Метод

Uses the output stream 'os' for writing the bit stream, using the 'he' header encoder. The magic number is written to the bit stream. Normally, the header encoder must be empty (i.e. no data has been written to it yet). No BufferedOutputStream is used on top of the output stream 'os'.
If an error occurs while writing the magic /// number to the 'os' output stream. /// ///
public FileCodestreamWriter ( System os, int mb ) : System
os System The output stream where to write the bit stream. /// ///
mb int The maximum number of bytes that can be written to the bit /// stream. /// ///
Результат System

close() публичный Метод

Writes the EOC marker.
If an error occurs while closing the underlying /// stream. /// ///
public close ( ) : void
Результат void

commitBitstreamHeader() публичный Метод

Writes the header data in the codestream and actualize ndata with the header length. The header is either a MainHeaderEncoder or a TileHeaderEncoder.
If an I/O error occurs while writing the data. /// ///
public commitBitstreamHeader ( HeaderEncoder he ) : void
he HeaderEncoder The current header encoder. /// ///
Результат void

writePacketBody() публичный Метод

Writes a packet body to the bit stream 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.

If the length of the data that is to be written to the bit stream is more than the space left (as returned by getMaxAvailableBytes()) only the data that does not exceed the allowed length is written, the rest is discarded. However the value returned by the method is the total length of the packet body , as if all of it was written to the bit stream.

If an I/O error occurs while writing to the /// output stream. /// ///
public writePacketBody ( byte body, int blen, bool sim, bool roiInPkt, int roiLen ) : int
body byte The packet body data. /// ///
blen int The number of bytes in the packet body. /// ///
sim bool Simulation mode flag. If true nothing is written to the bit /// stream, but the number of bytes that would be written is returned. /// ///
roiInPkt bool Whether or not this packet contains ROI information /// ///
roiLen int Number of byte to read in packet body to get all the ROI /// information /// ///
Результат int

writePacketHead() публичный Метод

Writes a packet head to the bit stream and returns the number of bytes used by this header. It returns the total number of bytes that the packet head takes in the bit stream. 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.

If the length of the data that is to be written to the bit stream is more than the space left (as returned by getMaxAvailableBytes()) only the data that does not exceed the allowed length is written, 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.

If the bit stream header has not been commited yet and 'sim' is false, then the bit stream header is automatically commited (see commitBitstreamHeader() method) before writting the packet.

If an I/O error occurs while writing to the /// output stream. /// ///
public writePacketHead ( byte head, int hlen, bool sim, bool sop, bool eph ) : int
head byte The packet head data. /// ///
hlen int The number of bytes in the packet head. /// ///
sim bool Simulation mode flag. If true nothing is written to the bit /// stream, but the number of bytes that would be written is returned. /// ///
sop bool Start of packet header marker flag. This flag indicates /// whether or not SOP markers should be written. If true, SOP markers /// should be written, if false, they should not. /// ///
eph bool End of Packet Header marker flag. This flag indicates /// whether or not EPH markers should be written. If true, EPH markers /// should be written, if false, they should not. /// ///
Результат int

Описание свойств

DEF_BUF_LEN публичное статическое свойство

The default buffer length, 1024 bytes
public static int DEF_BUF_LEN
Результат int