←Select platform

IsFeedLoadDone Property

Summary
Determines if the feed-load process is done.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public bool IsFeedLoadDone { get; } 
@property (nonatomic, assign, readonly) BOOL isFeedLoadDone 
public boolean isFeedLoadDone() 
public: 
property bool IsFeedLoadDone { 
   bool get(); 
} 
IsFeedLoadDone # get  (RasterCodecs) 

Property Value

true if the feed-load process is done; false, otherwise. The default value is true.

Remarks

Checking the value of IsFeedLoadDone is useful to exit out of the feed-load process when sufficient data has been collected to load all the pages requested.

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Svg; 
 
 
public void FeedLoadMultiExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Eye.gif"); 
   string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "FeedLoadMulti.tif"); 
 
   // Load pages 2 through 5 from the file by reading chunks from the stream 
   codecs.StartFeedLoad(0, CodecsLoadByteOrder.BgrOrGray, 2, 5); 
 
   using (FileStream fs = File.OpenRead(srcFileName)) 
   { 
      const int bufferSize = 1024; 
      byte[] buffer = new byte[bufferSize]; 
 
      int read; 
 
      do 
      { 
         System.Windows.Forms.Application.DoEvents(); 
 
         read = fs.Read(buffer, 0, bufferSize); 
         Debug.WriteLine("Feeding {0} bytes", read); 
         if (read > 0) 
            codecs.FeedLoad(buffer, 0, read); 
      } 
      while (read > 0 && !codecs.IsFeedLoadDone); 
   } 
 
   RasterImage image = codecs.StopFeedLoad(); 
   Debug.WriteLine("{0} pages loaded", image.PageCount); 
 
   // Save the image to disk 
   codecs.Save(image, destFileName, RasterImageFormat.Tif, 1, 1, -1, 1, CodecsSavePageMode.Overwrite); 
   image.Dispose(); 
 
   // Clean up 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.*; 
import java.net.*; 
import java.nio.file.Paths; 
import java.util.*; 
import java.time.Instant; 
import java.time.Duration; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.codecs.RasterCodecs.FeedCallbackThunk; 
import leadtools.drawing.internal.*; 
import leadtools.imageprocessing.*; 
import leadtools.imageprocessing.color.ChangeIntensityCommand; 
import leadtools.svg.*; 
 
 
public void feedLoadMultiExample() throws IOException { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   RasterCodecs codecs = new RasterCodecs(); 
 
   String srcFileName = combine(LEAD_VARS_IMAGES_DIR, "Eye.gif"); 
   String destFileName = combine(LEAD_VARS_IMAGES_DIR, "FeedLoadMulti.tif"); 
 
   // Load pages 2 through 5 from the file by reading chunks from the stream 
   FeedCallbackThunk feedLoad = codecs.startFeedLoad(0, CodecsLoadByteOrder.BGR_OR_GRAY, 2, 5); 
 
   try (InputStream fileStream = new FileInputStream(srcFileName)) { 
      final int bufferSize = 1024; 
      byte[] buffer = new byte[bufferSize]; 
      int read = 0; 
 
      do { 
         read = fileStream.read(buffer, 0, bufferSize); 
         System.out.println("Feeding " + read + " bytes"); 
         if (read > 0) 
            feedLoad.feedLoad(buffer, 0, read); 
      } while (read > 0 && !feedLoad.isFeedLoadDone()); 
   } 
   RasterImage image = feedLoad.stopFeedLoad(); 
   System.out.println(image.getPageCount() + " pages loaded"); 
 
   // Save the image to disk 
   codecs.save(image, destFileName, RasterImageFormat.TIF, 1, 1, -1, 1, CodecsSavePageMode.OVERWRITE); 
   assertTrue("Image unsuccessfully saved", (new File(destFileName)).exists()); 
   System.out.println("Saved image at" + destFileName); 
 
   // Clean up 
   image.dispose(); 
   codecs.dispose(); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Codecs Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.