Ignore:
Timestamp:
Aug 21, 2008, 7:21:48 PM (16 years ago)
Author:
イグトランス (egtra)
Message:

非同期入出力(Begin/End-Read/Writeメソッド)を実装。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/Classes/System/IO/MemoryStream.ab

    r472 r605  
    173173    Virtual Sub Capacity(value As Long)
    174174        If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
    175         If value < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Capacity: A capacity is set to negative value.", New System.Int64(value),"Capacity")
    176         If value < This.streamLength Then Throw New ArgumentOutOfRangeException("MemoryStream.Capacity: A capacity is less than the current length of the stream.",New System.Int64(value),"Capacity")
     175        If value < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Capacity: A capacity is set to negative value.", New System.UInt64(value),"Capacity")
     176        If value < This.streamLength Then Throw New ArgumentOutOfRangeException("MemoryStream.Capacity: A capacity is less than the current length of the stream.",New System.UInt64(value),"Capacity")
    177177        This.pointer = This.reallocate(This.pointer,value)
    178178    End Sub
     
    193193    @date   2008/3/12
    194194    */
    195     Override Function Length() As Int64
     195    Override Function Length() As QWord
    196196        If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
    197197        Return This.streamLength
     
    203203    @date   2008/3/12
    204204    */
    205     Override Sub Position(value As Int64)
    206         If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
    207         If value < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Position: The position is set to a negative value.", New System.Int64(value), "Position")
    208         If value > Int32.MaxValue() Then Throw New ArgumentOutOfRangeException("MemoryStream.Position: The position is a value greater than MaxValue.", New System.Int64(value), "Position")
     205    Override Sub Position(value As QWord)
     206        If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
     207        If value < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Position: The position is set to a negative value.", New System.UInt64(value), "Position")
     208        If value > Int32.MaxValue() Then Throw New ArgumentOutOfRangeException("MemoryStream.Position: The position is a value greater than MaxValue.", New System.UInt64(value), "Position")
    209209        This.currentPosition = value As Long
    210210    End Sub
     
    215215    @date   2008/3/12
    216216    */
    217     Override Function Position() As Int64
    218         If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
    219         Return This.currentPosition As Int64
     217    Override Function Position() As QWord
     218        If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
     219        Return This.currentPosition As QWord
    220220    End Function
    221221
     
    236236        If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
    237237        If buffer = 0 Then Throw New ArgumentNullException("FileStream.Read: An argument is a null value.", "buffer")
    238         If offset < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Read: An argument is a negative value.", New System.Int64(offset), "offset")
    239         If count < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Read: An argument is a negative value.", New System.Int64(count), "count")
     238        If offset < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Read: An argument is a negative value.", New System.UInt64(offset), "offset")
     239        If count < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Read: An argument is a negative value.", New System.UInt64(count), "count")
    240240        If (This.streamLength - (This.currentPosition + count)) < 0 Then
    241241            count + = (This.streamLength - (This.currentPosition + count))
     
    270270    Override Function Seek(offset As Int64, origin As SeekOrigin) As Int64
    271271        If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
    272         If offset > Int32.MaxValue() Then Throw New ArgumentOutOfRangeException("MemoryStream.Seek: The offset is a value greater than MaxValue.", New System.Int64(offset), "offset")
     272        If offset > Int32.MaxValue() Then Throw New ArgumentOutOfRangeException("MemoryStream.Seek: The offset is a value greater than MaxValue.", New System.UInt64(offset), "offset")
    273273        Select Case origin
    274274            Case SeekOrigin.Begin
     
    285285                Throw New ArgumentException("MemoryStream.Seek: An argument is an invalid SeekOrigin","origin")
    286286        End Select
    287         Return This.currentPosition As Int64
     287        Return This.currentPosition As QWord
    288288    End Function
    289289
     
    293293    @date   2008/3/12
    294294    */
    295     Override Sub SetLength(value As Int64)
     295    Override Sub SetLength(value As QWord)
    296296        If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
    297297        If This.writable = False Then Throw New NotSupportedException("MemoryStream: The current stream is not writable")
    298298        If This.resizable = False Then Throw New NotSupportedException("MemoryStream: The current stream is not resizable")
    299299        If value > This.Capacity() Then Throw New NotSupportedException("MemoryStream.SetLength: This stream length is larger than the current capacity.")
    300         If value < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Read: An argument is a negative value.", New System.Int64(value), "value")
    301         If value > Int32.MaxValue() Then Throw New ArgumentOutOfRangeException("MemoryStream.SetLength: The length is a value greater than MaxValue.", New System.Int64(value), "value")
     300        If value < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Read: An argument is a negative value.", New System.UInt64(value), "value")
     301        If value > Int32.MaxValue() Then Throw New ArgumentOutOfRangeException("MemoryStream.SetLength: The length is a value greater than MaxValue.", New System.UInt64(value), "value")
    302302        This.pointer = This.reallocate(This.pointer,value As Long)
    303303        This.streamLength = value As Long
     
    313313        If This.writable = False Then Throw New NotSupportedException("MemoryStream: The current stream is not writable")
    314314        If buffer = 0 Then Throw New ArgumentNullException("MemoryStream.Write: An argument is a null value.", "buffer")
    315         If offset < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Write: An argument is a negative value.", New System.Int64(offset), "offset")
    316         If count < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Write: An argument is a negative value.", New System.Int64(count), "count")
    317         If count > (This.streamLength - This.currentPosition) Then 
     315        If offset < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Write: An argument is a negative value.", New System.UInt64(offset), "offset")
     316        If count < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Write: An argument is a negative value.", New System.UInt64(count), "count")
     317        If count > (This.streamLength - This.currentPosition) Then
    318318            If This.resizable = False Then Throw New NotSupportedException("MemoryStream: The current stream is not resizable")
    319             If (This.Capacity() - This.currentPosition) < count Then 
     319            If (This.Capacity() - This.currentPosition) < count Then
    320320                This.pointer = This.reallocate(This.pointer,This.currentPosition+count)
    321321            End If
Note: See TracChangeset for help on using the changeset viewer.