EndOfStreamException クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<SerializableAttribute> _ <ComVisibleAttribute(True)> _ Public Class EndOfStreamException Inherits IOException
[SerializableAttribute] [ComVisibleAttribute(true)] public ref class EndOfStreamException : public IOException

EndOfStreamException は、値 0x80070026 の HRESULT COR_E_ENDOFSTREAM を使用します。

MemoryStream クラス上で BinaryReader クラスと BinaryWriter クラスを使用し、メモリに対して Double データの読み取りと書き込みを実行する方法を次のコード例に示します。
Imports System Imports System.IO Public Class BinaryRW Shared Sub Main() Dim i As Integer Const upperBound As Integer = 1000 ' Create random data to write to the stream. Dim dataArray(upperBound) As Double Dim randomGenerator As New Random() For i = 0 To upperBound dataArray(i) = 100.1 * randomGenerator.NextDouble() Next i Dim binWriter As New BinaryWriter(New MemoryStream()) Try ' Write data to the stream. Console.WriteLine("Writing data to the stream.") For i = 0 To upperBound binWriter.Write(dataArray(i)) Next i ' Create a reader using the stream from the writer. Dim binReader As New BinaryReader(binWriter.BaseStream) ' Return to the beginning of the stream. binReader.BaseStream.Position = 0 ' Read and verify the data. Try Console.WriteLine("Verifying the written data.") For i = 0 To upperBound If binReader.ReadDouble() <> dataArray(i) Then Console.WriteLine("Error writing data.") Exit For End If Next i Console.WriteLine("The data was written and verified.") Catch ex As EndOfStreamException Console.WriteLine("Error writing data: {0}.", _ ex.GetType().Name) End Try Finally binWriter.Close() End Try End Sub End Class
using System; using System.IO; class BinaryRW { static void Main() { int i; const int arrayLength = 1000; // Create random data to write to the stream. Random randomGenerator = new Random(); double[] dataArray = new double[arrayLength]; for(i = 0; i < arrayLength; i++) { dataArray[i] = 100.1 * randomGenerator.NextDouble(); } using(BinaryWriter binWriter = new BinaryWriter(new MemoryStream())) { // Write the data to the stream. Console.WriteLine("Writing data to the stream."); for(i = 0; i < arrayLength; i++) { binWriter.Write(dataArray[i]); } // Create a reader using the stream from the writer. using(BinaryReader binReader = new BinaryReader(binWriter.BaseStream)) { try { // Return to the beginning of the stream. binReader.BaseStream.Position = 0; // Read and verify the data. Console.WriteLine("Verifying the written data."); for(i = 0; i < arrayLength; i++) { if(binReader.ReadDouble() != dataArray[i]) { Console.WriteLine("Error writing data."); break; } } Console.WriteLine("The data was written " + "and verified."); } catch(EndOfStreamException e) { Console.WriteLine("Error writing data: {0}.", e.GetType().Name); } } } } }
using namespace System; using namespace System::IO; int main() { int i; const int arrayLength = 1000; // Create random data to write to the stream. array<double>^dataArray = gcnew array<double>(arrayLength); Random^ randomGenerator = gcnew Random; for ( i = 0; i < arrayLength; i++ ) { dataArray[ i ] = 100.1 * randomGenerator->NextDouble(); } BinaryWriter^ binWriter = gcnew BinaryWriter( gcnew MemoryStream ); try { // Write data to the stream. Console::WriteLine( "Writing data to the stream." ); i = 0; for ( i = 0; i < arrayLength; i++ ) { binWriter->Write( dataArray[ i ] ); } // Create a reader using the stream from the writer. BinaryReader^ binReader = gcnew BinaryReader( binWriter->BaseStream ); // Return to the beginning of the stream. binReader->BaseStream->Position = 0; try { // Read and verify the data. i = 0; Console::WriteLine( "Verifying the written data." ); for ( i = 0; i < arrayLength; i++ ) { if ( binReader->ReadDouble() != dataArray[ i ] ) { Console::WriteLine( "Error writing data." ); break; } } Console::WriteLine( "The data was written and verified." ); } catch ( EndOfStreamException^ e ) { Console::WriteLine( "Error writing data: {0}.", e->GetType()->Name ); } } finally { binWriter->Close(); } }
import System.*; import System.IO.*; class BinaryRW { public static void main(String[] args) { int i; final int arrayLength = 1000; // Create random data to write to the stream. Random randomGenerator = new Random(); double dataArray[] = new double[arrayLength]; for(i = 0;i < arrayLength;i++) { dataArray[i] = 100.1*randomGenerator.NextDouble() ; } BinaryWriter binWriter = new BinaryWriter(new MemoryStream()); try { // Write the data to the stream. Console.WriteLine("Writing data to the stream."); for(i = 0;i < arrayLength;i++) { binWriter.Write(dataArray [ i]); } // Create a reader using the stream from the writer. BinaryReader binReader = new BinaryReader(binWriter.get_BaseStream()); try { try { // Return to the beginning of the stream. binReader.get_BaseStream().set_Position(0); // Read and verify the data. Console.WriteLine("Verifying the written data."); for(i = 0;i < arrayLength;i++) { if ( binReader.ReadDouble() != dataArray[i] ) { Console.WriteLine("Error writing data."); break; } } Console.WriteLine(("The data was written " + "and verified.")); } catch(EndOfStreamException e) { Console.WriteLine("Error writing data: {0}.", e.GetType().get_Name()); } } finally { if (binReader != null) { binReader = null; } } } finally { if (binWriter != null) { binWriter = null; } } } //main } //BinaryRW

System.Exception
System.SystemException
System.IO.IOException
System.IO.EndOfStreamException


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


EndOfStreamException コンストラクタ ()
アセンブリ: mscorlib (mscorlib.dll 内)


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


EndOfStreamException コンストラクタ (SerializationInfo, StreamingContext)
アセンブリ: mscorlib (mscorlib.dll 内)

Dim info As SerializationInfo Dim context As StreamingContext Dim instance As New EndOfStreamException(info, context)

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


EndOfStreamException コンストラクタ (String)
アセンブリ: mscorlib (mscorlib.dll 内)


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


EndOfStreamException コンストラクタ

名前 | 説明 |
---|---|
EndOfStreamException () | メッセージ文字列がシステムによって提供されたメッセージに設定され、HRESULT が COR_E_ENDOFSTREAM に設定された EndOfStreamException クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
EndOfStreamException (String) | メッセージ文字列を message に設定し、HRESULT を COR_E_ENDOFSTREAM に設定して、EndOfStreamException クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
EndOfStreamException (SerializationInfo, StreamingContext) | 指定したシリアル化情報とコンテキスト情報を使用して、EndOfStreamException クラスの新しいインスタンスを初期化します。 |
EndOfStreamException (String, Exception) | 指定したエラー メッセージと、この例外の原因である内部例外への参照を使用して、EndOfStreamException クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |

EndOfStreamException コンストラクタ (String, Exception)
アセンブリ: mscorlib (mscorlib.dll 内)

Dim message As String Dim innerException As Exception Dim instance As New EndOfStreamException(message, innerException)

前の例外の直接の結果としてスローされる例外については、InnerException プロパティに、前の例外への参照が格納されます。InnerException プロパティは、コンストラクタに渡されたものと同じ値を返します。InnerException プロパティによって内部例外値がコンストラクタに渡されなかった場合は、null 参照 (Visual Basic では Nothing) を返します。
EndOfStreamException のインスタンスの初期プロパティ値を次の表に示します。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


EndOfStreamException プロパティ

名前 | 説明 | |
---|---|---|
![]() | Data | 例外に関する追加のユーザー定義情報を提供するキー/値ペアのコレクションを取得します。 ( Exception から継承されます。) |
![]() | HelpLink | 例外に関連付けられているヘルプ ファイルへのリンクを取得または設定します。 ( Exception から継承されます。) |
![]() | InnerException | 現在の例外を発生させた Exception インスタンスを取得します。 ( Exception から継承されます。) |
![]() | Message | 現在の例外を説明するメッセージを取得します。 ( Exception から継承されます。) |
![]() | Source | エラーの原因となったアプリケーションまたはオブジェクトの名前を取得または設定します。 ( Exception から継承されます。) |
![]() | StackTrace | 現在の例外がスローされたときにコール スタックにあったフレームの文字列形式を取得します。 ( Exception から継承されます。) |
![]() | TargetSite | 現在の例外をスローするメソッドを取得します。 ( Exception から継承されます。) |


EndOfStreamException メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetBaseException | 派生クラスでオーバーライドされた場合、それ以後に発生する 1 つ以上の例外の主要な原因である Exception を返します。 ( Exception から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetObjectData | 派生クラスでオーバーライドされた場合は、その例外に関する情報を使用して SerializationInfo を設定します。 ( Exception から継承されます。) |
![]() | GetType | 現在のインスタンスのランタイム型を取得します。 ( Exception から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の例外の文字列形式を作成して返します。 ( Exception から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

EndOfStreamException メンバ
ストリームの末尾を越えて読み込もうとしたときにスローされる例外。
EndOfStreamException データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | EndOfStreamException | オーバーロードされます。 EndOfStreamException クラスの新しいインスタンスを初期化します。 |


名前 | 説明 | |
---|---|---|
![]() | Data | 例外に関する追加のユーザー定義情報を提供するキー/値ペアのコレクションを取得します。(Exception から継承されます。) |
![]() | HelpLink | 例外に関連付けられているヘルプ ファイルへのリンクを取得または設定します。(Exception から継承されます。) |
![]() | InnerException | 現在の例外を発生させた Exception インスタンスを取得します。(Exception から継承されます。) |
![]() | Message | 現在の例外を説明するメッセージを取得します。(Exception から継承されます。) |
![]() | Source | エラーの原因となったアプリケーションまたはオブジェクトの名前を取得または設定します。(Exception から継承されます。) |
![]() | StackTrace | 現在の例外がスローされたときにコール スタックにあったフレームの文字列形式を取得します。(Exception から継承されます。) |
![]() | TargetSite | 現在の例外をスローするメソッドを取得します。(Exception から継承されます。) |


名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetBaseException | 派生クラスでオーバーライドされた場合、それ以後に発生する 1 つ以上の例外の主要な原因である Exception を返します。 (Exception から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetObjectData | 派生クラスでオーバーライドされた場合は、その例外に関する情報を使用して SerializationInfo を設定します。 (Exception から継承されます。) |
![]() | GetType | 現在のインスタンスのランタイム型を取得します。 (Exception から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の例外の文字列形式を作成して返します。 (Exception から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からEndOfStreamExceptionを検索する場合は、下記のリンクをクリックしてください。

- EndOfStreamExceptionのページへのリンク