author | Jan Vrany <jan.vrany@labware.com> |
Mon, 29 Nov 2021 23:00:04 +0000 | |
branch | jv |
changeset 25437 | 622824e701ea |
parent 18120 | e3a375d5f6a8 |
permissions | -rw-r--r-- |
7593 | 1 |
" |
2 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5409 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
4763 | 14 |
OSHandle subclass:#OSFileHandle |
15 |
instanceVariableNames:'' |
|
16 |
classVariableNames:'ConcreteClass' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'System-Support' |
|
19 |
! |
|
20 |
||
7593 | 21 |
!OSFileHandle class methodsFor:'documentation'! |
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! ! |
|
4763 | 36 |
|
37 |
!OSFileHandle class methodsFor:'initialization'! |
|
38 |
||
39 |
initialize |
|
40 |
"initialize for the OS we are running on" |
|
41 |
||
42 |
self initializeConcreteClass |
|
43 |
||
44 |
" |
|
45 |
self initialize |
|
46 |
" |
|
47 |
||
48 |
||
49 |
! |
|
50 |
||
51 |
initializeConcreteClass |
|
52 |
"initialize for the OS we are running on" |
|
53 |
||
54 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
6289 | 55 |
ConcreteClass := Win32FILEHandle |
4763 | 56 |
] ifFalse:[ |
57 |
OperatingSystem isVMSlike ifTrue:[ |
|
58 |
ConcreteClass := OpenVMSFileHandle |
|
59 |
] ifFalse:[ |
|
60 |
OperatingSystem isUNIXlike ifTrue:[ |
|
61 |
ConcreteClass := UnixFileHandle |
|
62 |
] ifFalse:[ |
|
63 |
ConcreteClass := nil |
|
64 |
] |
|
65 |
] |
|
66 |
] |
|
67 |
||
68 |
" |
|
69 |
self initializeConcreteClass |
|
70 |
" |
|
71 |
||
72 |
"Modified: 7.9.1997 / 23:32:37 / cg" |
|
73 |
||
74 |
||
75 |
! |
|
76 |
||
77 |
reinitialize |
|
78 |
"initialize for the OS we are running on" |
|
79 |
||
80 |
self initializeConcreteClass |
|
81 |
||
82 |
" |
|
83 |
self reinitialize |
|
84 |
" |
|
85 |
||
86 |
! ! |
|
87 |
||
88 |
!OSFileHandle methodsFor:'finalization'! |
|
89 |
||
6439
0f841258ec4a
Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents:
6289
diff
changeset
|
90 |
finalize |
5409 | 91 |
"a filedescriptor was garbage collected - close the underlying file" |
4763 | 92 |
|
16549 | 93 |
"/ with timeout to avoid blocking in a bad pty/socket |
94 |
[ |
|
95 |
self closeFile |
|
96 |
] valueWithTimeout:30 seconds |
|
5409 | 97 |
! ! |
98 |
||
5413 | 99 |
!OSFileHandle methodsFor:'input/output'! |
100 |
||
101 |
readBytes:count into:aByteBuffer startingAt:startAddress |
|
102 |
"read count bytes into a byte-buffer; |
|
103 |
Return the number of bytes read (negative on error)" |
|
104 |
||
105 |
^ self subclassResponsibility |
|
106 |
||
107 |
! |
|
108 |
||
109 |
writeBytes:count from:aByteBuffer startingAt:startAddress |
|
110 |
"write count bytes from a byte-buffer; |
|
111 |
Return the number of bytes written (negative on error)" |
|
112 |
||
113 |
^ self subclassResponsibility |
|
114 |
||
115 |
! ! |
|
116 |
||
5409 | 117 |
!OSFileHandle methodsFor:'release'! |
118 |
||
119 |
close |
|
120 |
"close the file" |
|
121 |
||
122 |
self closeFile. |
|
123 |
self unregisterForFinalization. |
|
5413 | 124 |
! |
125 |
||
126 |
closeFile |
|
127 |
"close the underlying file" |
|
128 |
||
129 |
self subclassResponsibility |
|
130 |
||
4763 | 131 |
! ! |
132 |
||
133 |
!OSFileHandle class methodsFor:'documentation'! |
|
134 |
||
135 |
version |
|
16549 | 136 |
^ '$Header: /cvs/stx/stx/libbasic/OSFileHandle.st,v 1.8 2014-06-07 15:08:16 cg Exp $' |
4763 | 137 |
! ! |
7593 | 138 |
|
16549 | 139 |
|
4763 | 140 |
OSFileHandle initialize! |