jp2_output_box * open_stream( )
Java: Jp2_output_box Open_stream( )
[Declared in "../apps/compressed_io/jpx.h"]
Returns a pointer to an internal jp2_output_box object to which you should write the codestream data itself. This is normally accomplished by passing the resulting pointer to kdu_codestream::create, but you may also write to the box directly (e.g., to copy a codestream from one file to another).
You may call this function only once, and you must close the returned box before attempting to open any other codestream box. Furthermore, you must call jpx_target::write_headers first to generate the header information, after which you must open, write and close each codestream box in order. If your application violates any of these conditions, an error will be delivered through kdu_error.
In many cases, you may wish to create a kdu_codestream object before the codestream box can be opened — i.e., before the JPX file header can be written. In particular, it is often convenient to use an open kdu_codestream to initialize the jp2_dimensions object. The access_stream function enables you to obtain the interface required to create a kdu_codestream object prior to the point at which the present function is called, but note that you MUST at least call open_stream before making any attempt to flush codestream data with kdu_codestream::flush.