author | Claus Gittinger <cg@exept.de> |
Mon, 31 Mar 2003 11:53:22 +0200 | |
changeset 7142 | 7a6297c86ef4 |
parent 6439 | 0f841258ec4a |
child 7593 | e7550b9ef84a |
permissions | -rw-r--r-- |
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:[ |
|
6289 | 29 |
ConcreteClass := Win32FILEHandle |
4763 | 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 |
||
6439
0f841258ec4a
Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents:
6289
diff
changeset
|
64 |
finalize |
5409 | 65 |
"a filedescriptor was garbage collected - close the underlying file" |
4763 | 66 |
|
5409 | 67 |
self closeFile |
68 |
! ! |
|
69 |
||
5413 | 70 |
!OSFileHandle methodsFor:'input/output'! |
71 |
||
72 |
readBytes:count into:aByteBuffer startingAt:startAddress |
|
73 |
"read count bytes into a byte-buffer; |
|
74 |
Return the number of bytes read (negative on error)" |
|
75 |
||
76 |
^ self subclassResponsibility |
|
77 |
||
78 |
! |
|
79 |
||
80 |
writeBytes:count from:aByteBuffer startingAt:startAddress |
|
81 |
"write count bytes from a byte-buffer; |
|
82 |
Return the number of bytes written (negative on error)" |
|
83 |
||
84 |
^ self subclassResponsibility |
|
85 |
||
86 |
! ! |
|
87 |
||
5409 | 88 |
!OSFileHandle methodsFor:'release'! |
89 |
||
90 |
close |
|
91 |
"close the file" |
|
92 |
||
93 |
self closeFile. |
|
94 |
self unregisterForFinalization. |
|
4763 | 95 |
|
96 |
||
5413 | 97 |
! |
98 |
||
99 |
closeFile |
|
100 |
"close the underlying file" |
|
101 |
||
102 |
self subclassResponsibility |
|
103 |
||
4763 | 104 |
! ! |
105 |
||
106 |
!OSFileHandle class methodsFor:'documentation'! |
|
107 |
||
108 |
version |
|
6439
0f841258ec4a
Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents:
6289
diff
changeset
|
109 |
^ '$Header: /cvs/stx/stx/libbasic/OSFileHandle.st,v 1.5 2002-03-04 14:21:43 stefan Exp $' |
4763 | 110 |
! ! |
111 |
OSFileHandle initialize! |