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