Changeset 605 for trunk/ab5.0/ablib/src/Classes/System/IO/MemoryStream.ab
- Timestamp:
- Aug 21, 2008, 7:21:48 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/src/Classes/System/IO/MemoryStream.ab
r472 r605 173 173 Virtual Sub Capacity(value As Long) 174 174 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") 177 177 This.pointer = This.reallocate(This.pointer,value) 178 178 End Sub … … 193 193 @date 2008/3/12 194 194 */ 195 Override Function Length() As Int64195 Override Function Length() As QWord 196 196 If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.") 197 197 Return This.streamLength … … 203 203 @date 2008/3/12 204 204 */ 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") 209 209 This.currentPosition = value As Long 210 210 End Sub … … 215 215 @date 2008/3/12 216 216 */ 217 Override Function Position() As Int64218 If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.") 219 Return This.currentPosition As Int64217 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 220 220 End Function 221 221 … … 236 236 If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.") 237 237 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") 240 240 If (This.streamLength - (This.currentPosition + count)) < 0 Then 241 241 count + = (This.streamLength - (This.currentPosition + count)) … … 270 270 Override Function Seek(offset As Int64, origin As SeekOrigin) As Int64 271 271 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") 273 273 Select Case origin 274 274 Case SeekOrigin.Begin … … 285 285 Throw New ArgumentException("MemoryStream.Seek: An argument is an invalid SeekOrigin","origin") 286 286 End Select 287 Return This.currentPosition As Int64287 Return This.currentPosition As QWord 288 288 End Function 289 289 … … 293 293 @date 2008/3/12 294 294 */ 295 Override Sub SetLength(value As Int64)295 Override Sub SetLength(value As QWord) 296 296 If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.") 297 297 If This.writable = False Then Throw New NotSupportedException("MemoryStream: The current stream is not writable") 298 298 If This.resizable = False Then Throw New NotSupportedException("MemoryStream: The current stream is not resizable") 299 299 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") 302 302 This.pointer = This.reallocate(This.pointer,value As Long) 303 303 This.streamLength = value As Long … … 313 313 If This.writable = False Then Throw New NotSupportedException("MemoryStream: The current stream is not writable") 314 314 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 318 318 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 320 320 This.pointer = This.reallocate(This.pointer,This.currentPosition+count) 321 321 End If
Note:
See TracChangeset
for help on using the changeset viewer.