Leadtools.Codecs Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.17
LoadStatus Property
See Also  Example
Leadtools.Codecs Namespace > RasterCodecs Class : LoadStatus Property




Gets a value that allows the detection of whether the image was loaded with errors.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property LoadStatus As RasterExceptionCode
Visual Basic (Usage)Copy Code
Dim instance As RasterCodecs
Dim value As RasterExceptionCode
 
value = instance.LoadStatus
C# 
public RasterExceptionCode LoadStatus {get;}
Managed Extensions for C++ 
public: __property RasterExceptionCode get_LoadStatus();
C++/CLI 
public:
property RasterExceptionCode LoadStatus {
   RasterExceptionCode get();
}

Return Value

A RasterExceptionCode which indicates the result of the most recent load operation.

The most common return values are:

ValueMeaning
RasterExceptionCode.SuccessThe image loaded by the last load call does not have any errors.
RasterExceptionCode.CompressedDataFailureThere were errors decoding the last image. The bottom part of the image might be corrupted.
RasterExceptionCode.BadResyncMarkerSome of the resync markers were incorrect or missing while decoding the last image. Resync markers are used by JPEG files to recover from decoding errors. Portions of the image are corrupted. They are indicated by a checkerboard pattern.
RasterExceptionCode.FileReadThe file was truncated. The bottom part of the image is missing.

Example

Visual BasicCopy Code
RasterCodecs.LoadStatus
      Private Sub LoadStatusExample(ByVal fileName As String)
         RasterCodecs.Startup()
         Dim codecs As RasterCodecs = New RasterCodecs()
         Try
            Dim image As RasterImage = codecs.Load(fileName, 0, CodecsLoadByteOrder.Bgr, 1, 1)
            Dim loadStatusCode As RasterExceptionCode = codecs.LoadStatus
            If loadStatusCode = RasterExceptionCode.Success Then
               Console.WriteLine("The image was loaded successfully and with no errors")
            Else
               Console.WriteLine("The image was loaded, but it might have corrupted areas, error = {0}", loadStatusCode)
            End If

            image.Dispose()
         Catch ex As RasterException
            Console.WriteLine("LEADTOOLS could not load this image, error code is is '{0}', message is '{1}'", ex.Code, ex.Message)
         End Try

         ' Clean up
         codecs.Dispose()
         RasterCodecs.Shutdown()
      End Sub
C#Copy Code
RasterCodecs.LoadStatus 
      void LoadStatusExample(string fileName) 
      { 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
         try 
         { 
            RasterImage image = codecs.Load(fileName, 0, CodecsLoadByteOrder.Bgr, 1, 1); 
            RasterExceptionCode loadStatusCode = codecs.LoadStatus; 
            if(loadStatusCode == RasterExceptionCode.Success) 
               Console.WriteLine("The image was loaded successfully and with no errors"); 
            else 
               Console.WriteLine("The image was loaded, but it might have corrupted areas, error = {0}", loadStatusCode); 
 
            image.Dispose(); 
         } 
         catch(RasterException ex) 
         { 
            Console.WriteLine("LEADTOOLS could not load this image, error code is is '{0}', message is '{1}'", ex.Code, ex.Message); 
         } 
 
         // Clean up 
         codecs.Dispose(); 
         RasterCodecs.Shutdown(); 
      }

Remarks

An error return code is a warning that portions of the image that was last loaded might be corrupted.

This property should be called after a load method has been sucessfully called. This value is reset after each page is loaded, so if you are loading multiple pages, this error code is valid only for the last page.

If the last load method threw an exception, then this method should not be used, as its return value is undefined.

Note that this property is valid for the current thread. So it should be used in the same thread as the load method.

This is valid for all the methods that will load an image, including Load and FeedLoad.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also