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
データを保存するためのストリーム。