OSFileHandle.st
author Claus Gittinger <cg@exept.de>
Tue, 31 Jul 2001 17:10:05 +0200
changeset 5897 793b0adad934
parent 5413 4e67713bf25a
child 6289 82cf5f13d5d7
permissions -rw-r--r--
checkin from browser

"{ Package: 'stx:libbasic' }"

OSHandle subclass:#OSFileHandle
	instanceVariableNames:''
	classVariableNames:'ConcreteClass'
	poolDictionaries:''
	category:'System-Support'
!


!OSFileHandle class methodsFor:'initialization'!

initialize
    "initialize for the OS we are running on"

    self initializeConcreteClass

    "
     self initialize
    "


!

initializeConcreteClass
    "initialize for the OS we are running on"

    OperatingSystem isMSDOSlike ifTrue:[
        ConcreteClass := Win32FileHandle
    ] ifFalse:[
        OperatingSystem isVMSlike ifTrue:[
            ConcreteClass := OpenVMSFileHandle
        ] ifFalse:[
            OperatingSystem isUNIXlike ifTrue:[
                ConcreteClass := UnixFileHandle
            ] ifFalse:[
                ConcreteClass := nil
            ]
        ]
    ]

    "
     self initializeConcreteClass
    "

    "Modified: 7.9.1997 / 23:32:37 / cg"


!

reinitialize
    "initialize for the OS we are running on"

    self initializeConcreteClass

    "
     self reinitialize
    "

! !

!OSFileHandle methodsFor:'finalization'!

disposed
    "a filedescriptor was garbage collected - close the underlying file"

    self closeFile

! !

!OSFileHandle methodsFor:'input/output'!

readBytes:count into:aByteBuffer startingAt:startAddress
    "read count bytes into a byte-buffer;
     Return the number of bytes read (negative on error)"

    ^ self subclassResponsibility

!

writeBytes:count from:aByteBuffer startingAt:startAddress
    "write count bytes from a byte-buffer;
     Return the number of bytes written (negative on error)"

    ^ self subclassResponsibility

! !

!OSFileHandle methodsFor:'release'!

close
    "close the file"

    self closeFile.
    self unregisterForFinalization.


!

closeFile
    "close the underlying file"

    self subclassResponsibility

! !

!OSFileHandle class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/OSFileHandle.st,v 1.3 2000-06-23 19:43:57 cg Exp $'
! !
OSFileHandle initialize!