Changeset 468 for trunk/Include/Classes/System/IO
- Timestamp:
- Mar 9, 2008, 12:00:01 PM (17 years ago)
- Location:
- trunk/Include/Classes/System/IO
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/IO/DirectoryInfo.ab
r409 r468 59 59 Select Case error 60 60 Case ERROR_ALREADY_EXISTS 61 Throw New IOException("DirectoryInfo.CreateDirectory: The directory has already existed.")61 Exit Sub 'ディレクトリが既に存在するときは、何もしない。 62 62 Case Else 63 63 Throw New IOException("DirectoryInfo.CreateDirectory: Failed to CreateDirectory") -
trunk/Include/Classes/System/IO/Path.ab
r429 r468 88 88 */ 89 89 Static Function GetFullPath(path As String) As String 90 Return Combine(System.Environment.CurrentDirectory, path) 90 If IsPathRooted(path) Then 91 Return path 92 Else 93 Return Combine(System.Environment.CurrentDirectory, path) 94 End If 91 95 End Function 92 96 … … 172 176 Static Function GetTempPath() As String 173 177 Dim size = WIN32API_GetTempPath(0, 0) 174 Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PCTSTR 175 Dim len = WIN32API_GetTempPath(size, p) 178 Dim buf = New Text.StringBuilder(size) 179 buf.Length = size 180 Dim len = WIN32API_GetTempPath(size, StrPtr(buf)) 176 181 If (len > size) or len = 0 Then 177 182 Throw New IOException("Path.GetTempPath: Failed to GetTempPath.") 178 183 Else 179 Return New String(p, len As Long) 184 buf.Length = len 185 Return buf.ToString 180 186 End If 181 187 End Function … … 209 215 Static Const ExtensionSeparatorChar = &H2E As StrChar 210 216 Static Const InvalidPathChars = Ex"\q<>|\0\t" As String 211 Static Const UniformNamingConventionString = Ex"\\\\" As String217 Static Const UniformNamingConventionString = "\\" As String 212 218 213 219 '---------------------------------------------------------------- … … 227 233 Dim i As Long 228 234 For i = 0 To ELM(InvalidPathChars.Length) 229 If path.Contains(InvalidPathChars .Substring(i, 1)) Then235 If path.Contains(InvalidPathChars[i]) Then 230 236 Throw New IOException("Path.CheckPath: The path contains invalidPathChars.") 231 237 End If -
trunk/Include/Classes/System/IO/Stream.ab
r432 r468 7 7 8 8 Public 'Protected 9 Sub Stream(): End Sub 9 Sub Stream() 10 End Sub 10 11 Public 11 12 Virtual Sub ~Stream() … … 54 55 Dispose(True) 55 56 End Sub 56 Virtual Function EndRead(ByRef asyncResult As System.IAsyncResult) As Long: End Function 57 Virtual Sub EndWrite(ByRef asyncResult As System.IAsyncResult): End Sub 57 Virtual Function EndRead(ByRef asyncResult As System.IAsyncResult) As Long 58 End Function 59 Virtual Sub EndWrite(ByRef asyncResult As System.IAsyncResult) 60 End Sub 58 61 Abstract Sub Flush() 59 62 Abstract Function Read(buffer As *Byte, offset As Long, count As Long) As Long … … 72 75 Abstract Sub SetLength(value As Int64) 73 76 Abstract Sub Write(buffer As *Byte, offset As Long, count As Long) 74 75 77 Virtual Sub WriteByte(b As Byte) 76 78 Write(VarPtr(b), 0, 1) -
trunk/Include/Classes/System/IO/StreamWriter.ab
r271 r468 4 4 5 5 Class StreamWriter 6 ' TODO: 実装 6 Inherits TextWriter 7 Public 8 /* 9 @date 2008/02/25 10 @auther Egtra 11 */ 12 Sub StreamWriter(path As String) 13 init(New FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None)) 14 End Sub 15 16 /* 17 @date 2008/02/25 18 @auther Egtra 19 */ 20 Sub StreamWriter(stream As Stream) 21 init(stream) 22 End Sub 23 24 Override Sub Write(str As String) 25 buf.Append(str) 26 Dim len = buf.Length 27 If len >= 2048 Then 28 s.Write(StrPtr(buf) As *Byte, 0, len) 29 buf.Length = 0 30 End If 31 End Sub 32 33 Override Sub Write(x As Boolean) 34 buf.Append(x) 35 End Sub 36 37 Override Sub Write(x As Char) 38 buf.Append(x) 39 End Sub 40 41 Override Sub Write(x As Byte) 42 buf.Append(x) 43 End Sub 44 #ifdef UNICODE 45 Override Sub Write(x As SByte) 46 buf.Append(x) 47 End Sub 48 #else 49 Override Sub Write(x As Word) 50 buf.Append(x) 51 End Sub 52 #endif 53 Override Sub Write(x As Integer) 54 buf.Append(x) 55 End Sub 56 57 Override Sub Write(x As DWord) 58 buf.Append(x) 59 End Sub 60 61 Override Sub Write(x As Long) 62 buf.Append(x) 63 End Sub 64 65 Override Sub Write(x As QWord) 66 buf.Append(x) 67 End Sub 68 69 Override Sub Write(x As Int64) 70 buf.Append(x) 71 End Sub 72 73 Override Sub Write(x As Single) 74 buf.Append(x) 75 End Sub 76 77 Override Sub Write(x As Double) 78 buf.Append(x) 79 End Sub 80 81 Override Sub Write(x As Object) 82 Write(x.ToString) 83 End Sub 84 85 Protected 86 Override Sub Dispose(disposing As Boolean) 87 If disposing Then 88 s.Dispose() 89 End If 90 End Sub 91 92 Private 93 Sub init(stream As Stream) 94 s = stream 95 buf = New System.Text.StringBuilder(4096) 96 End Sub 97 98 buf As Text.StringBuilder 99 s As System.IO.Stream 7 100 End Class 8 101 -
trunk/Include/Classes/System/IO/TextReader.ab
r457 r468 101 101 102 102 Protected 103 Abstract Sub Dispose(disposing As Boolean) 103 Virtual Sub Dispose(disposing As Boolean) 104 End Sub 104 105 105 106 /*
Note:
See TracChangeset
for help on using the changeset viewer.