Namespace System Namespace IO Class Stream Implements IDisposable Protected Sub Stream() End Sub Public Sub ~Stream() This.Dispose(False) End Sub Public Abstract Function CanRead() As Boolean Abstract Function CanSeek() As Boolean Virtual Function CanTimeout() As Boolean Return False End Function Abstract Function CanWrite() As Boolean Abstract Function Length() As QWord Abstract Sub Position(value As QWord) Abstract Function Position() As QWord Virtual Sub ReadTimeout(value As Long) Throw New InvalidOperationException("Stream does not support Timeout.") End Sub Virtual Function ReadTimeout() As Long Throw New InvalidOperationException("Stream does not support Timeout.") End Function Virtual Sub WriteTimeout(value As Long) Throw New InvalidOperationException("Stream does not support Timeout.") End Sub Virtual Function WriteTimeout() As Long Throw New InvalidOperationException("Stream does not support Timeout.") End Function Public Virtual Function BeginRead(buffer As *Byte, offset As Long, count As Long, callback As AsyncCallback, state As Object) As System.IAsyncResult Dim r = Read(buffer,offset,count) Return New Detail.SyncStreamResultImpl(r, state) End Function Virtual Function BeginWrite(buffer As *Byte, offset As Long, count As Long, callback As AsyncCallback, state As Object) As System.IAsyncResult Write(buffer,offset,count) Return New Detail.SyncStreamResultImpl(0, state) End Function Sub Close() Dispose(True) End Sub Sub Dispose() Dispose(True) End Sub Virtual Function EndRead(asyncResult As System.IAsyncResult) As Long Dim ar = asyncResult As Detail.IAsyncStreamResult EndRead = ar.WaitAndGetResult End Function Virtual Sub EndWrite(asyncResult As System.IAsyncResult) End Sub Abstract Sub Flush() Abstract Function Read(buffer As *Byte, offset As Long, count As Long) As Long Virtual Function ReadByte() As Long Dim b As Byte Dim ret = Read(VarPtr(b), 0, 1) If ret <> 0 Then Return b Else Return -1 End If End Function Abstract Function Seek(offset As Int64, origin As SeekOrigin) As Int64 Abstract Sub SetLength(value As QWord) Abstract Sub Write(buffer As *Byte, offset As Long, count As Long) Virtual Sub WriteByte(b As Byte) Write(VarPtr(b), 0, 1) End Sub Protected Virtual Sub Dispose(disposing As Boolean) End Sub End Class End Namespace End Namespace