5409
|
1 |
"{ Package: 'stx:libbasic' }"
|
|
2 |
|
4763
|
3 |
OSHandle subclass:#OSFileHandle
|
|
4 |
instanceVariableNames:''
|
|
5 |
classVariableNames:'ConcreteClass'
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'System-Support'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!OSFileHandle class methodsFor:'initialization'!
|
|
12 |
|
|
13 |
initialize
|
|
14 |
"initialize for the OS we are running on"
|
|
15 |
|
|
16 |
self initializeConcreteClass
|
|
17 |
|
|
18 |
"
|
|
19 |
self initialize
|
|
20 |
"
|
|
21 |
|
|
22 |
|
|
23 |
!
|
|
24 |
|
|
25 |
initializeConcreteClass
|
|
26 |
"initialize for the OS we are running on"
|
|
27 |
|
|
28 |
OperatingSystem isMSDOSlike ifTrue:[
|
|
29 |
ConcreteClass := Win32FileHandle
|
|
30 |
] ifFalse:[
|
|
31 |
OperatingSystem isVMSlike ifTrue:[
|
|
32 |
ConcreteClass := OpenVMSFileHandle
|
|
33 |
] ifFalse:[
|
|
34 |
OperatingSystem isUNIXlike ifTrue:[
|
|
35 |
ConcreteClass := UnixFileHandle
|
|
36 |
] ifFalse:[
|
|
37 |
ConcreteClass := nil
|
|
38 |
]
|
|
39 |
]
|
|
40 |
]
|
|
41 |
|
|
42 |
"
|
|
43 |
self initializeConcreteClass
|
|
44 |
"
|
|
45 |
|
|
46 |
"Modified: 7.9.1997 / 23:32:37 / cg"
|
|
47 |
|
|
48 |
|
|
49 |
!
|
|
50 |
|
|
51 |
reinitialize
|
|
52 |
"initialize for the OS we are running on"
|
|
53 |
|
|
54 |
self initializeConcreteClass
|
|
55 |
|
|
56 |
"
|
|
57 |
self reinitialize
|
|
58 |
"
|
|
59 |
|
|
60 |
! !
|
|
61 |
|
|
62 |
!OSFileHandle methodsFor:'finalization'!
|
|
63 |
|
|
64 |
disposed
|
5409
|
65 |
"a filedescriptor was garbage collected - close the underlying file"
|
4763
|
66 |
|
5409
|
67 |
self closeFile
|
|
68 |
|
|
69 |
! !
|
|
70 |
|
5413
|
71 |
!OSFileHandle methodsFor:'input/output'!
|
|
72 |
|
|
73 |
readBytes:count into:aByteBuffer startingAt:startAddress
|
|
74 |
"read count bytes into a byte-buffer;
|
|
75 |
Return the number of bytes read (negative on error)"
|
|
76 |
|
|
77 |
^ self subclassResponsibility
|
|
78 |
|
|
79 |
!
|
|
80 |
|
|
81 |
writeBytes:count from:aByteBuffer startingAt:startAddress
|
|
82 |
"write count bytes from a byte-buffer;
|
|
83 |
Return the number of bytes written (negative on error)"
|
|
84 |
|
|
85 |
^ self subclassResponsibility
|
|
86 |
|
|
87 |
! !
|
|
88 |
|
5409
|
89 |
!OSFileHandle methodsFor:'release'!
|
|
90 |
|
|
91 |
close
|
|
92 |
"close the file"
|
|
93 |
|
|
94 |
self closeFile.
|
|
95 |
self unregisterForFinalization.
|
4763
|
96 |
|
|
97 |
|
5413
|
98 |
!
|
|
99 |
|
|
100 |
closeFile
|
|
101 |
"close the underlying file"
|
|
102 |
|
|
103 |
self subclassResponsibility
|
|
104 |
|
4763
|
105 |
! !
|
|
106 |
|
|
107 |
!OSFileHandle class methodsFor:'documentation'!
|
|
108 |
|
|
109 |
version
|
5413
|
110 |
^ '$Header: /cvs/stx/stx/libbasic/OSFileHandle.st,v 1.3 2000-06-23 19:43:57 cg Exp $'
|
4763
|
111 |
! !
|
|
112 |
OSFileHandle initialize!
|