Class DataStreamSupporter
ชื่อพื้นที่: Aspose.Imaging การประกอบ: Aspose.Imaging.dll (25.4.0)
กระแสข้อมูลคอนเทนเนอร์
[JsonObject(MemberSerialization.OptIn)]
public abstract class DataStreamSupporter : DisposableObject, IDisposable
Inheritance
object ← DisposableObject ← DataStreamSupporter
Derived
Implements
อนุญาโตตุลาการ
DisposableObject.Dispose() , DisposableObject.ReleaseManagedResources() , DisposableObject.ReleaseUnmanagedResources() , DisposableObject.VerifyNotDisposed() , DisposableObject.Disposed , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Constructors
DataStreamSupporter()
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Imaging.DataStreamSupporter
[JsonConstructor]
protected DataStreamSupporter()
Fields
ระยะเวลา
ระยะเวลาที่จะรอการซิงค์
[JsonProperty]
protected int timeout
หมายเลข
Properties
DataStreamContainer
ได้รับการไหลของข้อมูลของวัตถุ
public StreamContainer DataStreamContainer { get; }
คุณสมบัติมูลค่า
IsCached
ได้รับค่าแสดงให้เห็นว่าข้อมูลของวัตถุจะถูกเข้ารหัสในขณะนี้และไม่จําเป็นต้องอ่านข้อมูล
public abstract bool IsCached { get; }
คุณสมบัติมูลค่า
Methods
CacheData()
ซ่อนข้อมูลและให้แน่ใจว่าไม่มีการโหลดข้อมูลเพิ่มเติมจะดําเนินการจาก Aspose.Imaging.DataStreamSupporter.DataStreamContainer
public abstract void CacheData()
Examples
ตัวอย่างต่อไปนี้แสดงให้เห็นว่าการเข้ารหัสภาพมีผลต่อประสิทธิภาพ ในกรณีทั่วไปการอ่านข้อมูลเข้ารหัสจะดําเนินการเร็วกว่าการอ่านข้อมูลที่ไม่เข้ารหัส
string dir = "c:\\temp\\";
// Load an image from a PNG file.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
// Cache all pixel data so that no additional data loading will be performed from the underlying data stream
image.CacheData();
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
stopwatch.Start();
// Reading all pixels is pretty fast.
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
for (int y = 0; y < image.Height; y++)
{
for (int x = 0; x < image.Width; x++)
{
int color = rasterImage.GetArgb32Pixel(x, y);
}
}
stopwatch.Stop();
System.Console.WriteLine("Reading all cached pixels took {0} ms.", stopwatch.ElapsedMilliseconds);
}
// Load an image from a PNG file
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
stopwatch.Start();
// Reading all pixels is not as fast as when caching
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
for (int y = 0; y < image.Height; y++)
{
for (int x = 0; x < image.Width; x++)
{
int color = rasterImage.GetArgb32Pixel(x, y);
}
}
stopwatch.Stop();
System.Console.WriteLine("Reading all pixels without preliminary caching took {0} ms.", stopwatch.ElapsedMilliseconds);
}
// The output may look like this:
// Reading all cached pixels took 1500 ms.
// Reading all pixels without preliminary caching took 150000 ms.
OnDataStreamContainerChanging(StreamContainer)
เรียกเมื่อคอนเทนเนอร์การไหลข้อมูลจะเปลี่ยนแปลง
protected virtual void OnDataStreamContainerChanging(StreamContainer streamContainer)
Parameters
streamContainer
StreamContainer
กระแสภาชนะ
ReleaseManagedResources()
เปิดตัวทรัพยากรที่จัดการ ตรวจสอบให้แน่ใจว่าไม่มีทรัพยากรที่ไม่ได้จัดการจะเปิดตัวที่นี่เนื่องจากอาจมีการเปิดตัวแล้ว
protected override void ReleaseManagedResources()
Save()
บันทึกข้อมูลของวัตถุไปยัง Aspose.Imaging.DataStreamSupporter ในปัจจุบัน
public virtual void Save()
Save(Stream)
บันทึกข้อมูลของวัตถุไปยังกระแสที่ระบุ
public void Save(Stream stream)
Parameters
stream
Stream
กระแสเพื่อบันทึกข้อมูลของวัตถุไปยัง
Save(รั้ว)
บันทึกข้อมูลของวัตถุไปยังตําแหน่งไฟล์ที่ระบุ
public virtual void Save(string filePath)
Parameters
filePath
string
เส้นทางไฟล์เพื่อบันทึกข้อมูลของวัตถุ
Save(บอล, บอล)
บันทึกข้อมูลของวัตถุไปยังตําแหน่งไฟล์ที่ระบุ
public virtual void Save(string filePath, bool overWrite)
Parameters
filePath
string
เส้นทางไฟล์เพื่อบันทึกข้อมูลของวัตถุ
overWrite
bool
หากคุณตั้งค่า “จริง” บนการเขียนเนื้อหาไฟล์อื่น ๆ การเพิ่มจะเกิดขึ้น
SaveData(Stream)
เก็บข้อมูล
protected abstract void SaveData(Stream stream)
Parameters
stream
Stream
กระแสเพื่อบันทึกข้อมูล