Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help
in

Setting FileStream position on Jp2.Read(FileStream)

Last post 11 Apr 2008, 1:52 PM by Linda Dickinson. 0 replies.
Sort Posts: Previous Next
  •  11 Apr 2008, 1:52 PM 13674

    Setting FileStream position on Jp2.Read(FileStream)


    There was a question on 05 Jun 2007 about the IsValidFormat method call which
    uses the FileStream as an input.

    -------------

       Does anyone knows exactly what happnes to the stream when
    RawDecoder->IsValidFormat(Stream) is called?  Sometimes when I
    called IsValidFormat method for the first time to a stream, it
    will return false, then if I immediately call the method again
    using the same stream, then it will return true.  What's the reason
    that the second call to the same stream returns a different result?
     Does the method move the stream reading position?  The RAW image I
    used is from one of the cameras that listed as supported cameras
    in the DotImage's documentation.

    ----------

    The answer was....


    This is most likely because the stream is not at the beginning the
    first time you call IsValidFormat.  I believe the IsValidFormat
    method will seek to the beginning after it's performed its check
    on the data, which is why the second time it works.

    Just call the stream.Seek method to move it to the beginning of the
    stream before calling IsValidFormat.


    ------------

    I was able to do this for IsValidFormat but I am having trouble
    with the Read method. I have a file which contains a header and then
    the codestream data. I am trying to set the file stream pointer to the
    beginning of the codestream and then read. I did this and it worked for IsValidFormat.
    When I set the filestream pointer to the beginning of the data in
    the codestream and then call a Read, I get a Jp2StartDecompress
    exception.

     

     

View as RSS news feed in XML