Category: Streams-Files
Superclass: FileDescriptor
My instances are what conventional programmers think of as files. My instance creation methods accept the name of a disk file (or any named file object, such as /dev/rmt0 on UNIX or MTA0: on VMS).

Method category index

file-in (class)
standard streams (class)
basic (instance)
buffering (instance)
compiling (instance)
initialize-release (instance)
overriding inherited methods (instance)
primitive (instance)
testing (instance)

file-in (class)

fileIn: aFileName
File in the aFileName file. During a file in operation, global variables (starting with an uppercase letter) that are not declared yet don't yield an `unknown variable' error. Instead, they are defined as nil in the `Undeclared' dictionary (a global variable residing in Smalltalk). As soon as you add the variable to a namespace (for example by creating a class) the Association will be removed from Undeclared and reused in the namespace, so that the old references will automagically point to the new value.

fileIn: aFileName ifMissing: aSymbol

Conditionally do a file in, only if the key (often a class) specified by 'aSymbol' is not present in the Smalltalk system dictionary already. During a file in operation, global variables (starting with an uppercase letter) that are not declared don't yield an `unknown variable' error. Instead, they are defined as nil in the `Undeclared' dictionary (a global variable residing in Smalltalk). As soon as you add the variable to a namespace (for example by creating a class) the Association will be removed from Undeclared and reused in the namespace, so that the old references will automagically point to the new value.

fileIn: aFileName ifTrue: aBoolean

Conditionally do a file in, only if the supplied boolean is true. During a file in operation, global variables (starting with an uppercase letter) that are not declared don't yield an `unknown variable' error. Instead, they are defined as nil in the `Undeclared' dictionary (a global variable residing in Smalltalk). As soon as you add the variable to a namespace (for example by creating a class) the Association will be removed from Undeclared and reused in the namespace, so that the old references will automagically point to the new value.

fileIn: aFileName line: lineInteger from: realFileName at: aCharPos

File in the aFileName file giving errors such as if it was loaded from the given line, file name and starting position (instead of 1).

generateMakefileOnto: aStream

Generate a make file for the file-ins since record was last set to true. Store it on aStream

initialize

Private - Initialize the receiver's class variables

record: recordFlag

Set whether Smalltalk should record information about nested file-ins. When recording is enabled, use #generateMakefileOnto: to automatically generate a valid makefile for the intervening file-ins.

require: assoc

Conditionally do a file in from the value of assoc, only if the key of assoc is not present in the Smalltalk system dictionary already. During a file in operation, global variables (starting with an uppercase letter) that are not declared don't yield an `unknown variable' error. Instead, they are defined as nil in the `Undeclared' dictionary (a global variable residing in Smalltalk). As soon as you add the variable to a namespace (for example by creating a class) the Association will be removed from Undeclared and reused in the namespace, so that the old references will automagically point to the new value.

verbose: verboseFlag

Set whether Smalltalk should output debugging messages when filing in

top


standard streams (class)

stderr
Answer a FileStream that is attached the Smalltalk program's standard error file handle, which can be used for error messages and diagnostics issued by the program.

stdin

Answer a FileStream that is attached the Smalltalk program's standard input file handle, which is the normal source of input for the program.

stdout

Answer a FileStream that is attached the Smalltalk program's standard output file handle; this is used for normal output from the program.

top


basic (instance)

bufferStart
Private - Answer the offset from the start of the file corresponding to the beginning of the read buffer.

copyFrom: from to: to

Answer the contents of the file between the two given positions

next

Return the next character in the file, or nil at eof

nextPut: aCharacter

Store aCharacter on the file

peek

Return the next character in the file, or nil at eof. Don't advance the file pointer.

position

Answer the zero-based position from the start of the file

position: n

Set the file pointer to the zero-based position n

size

Return the current size of the file, in bytes

truncate

Truncate the file at the current position

top


buffering (instance)

bufferSize
Answer the file's current buffer

bufferSize: bufSize

Flush the file and set the buffer's size to bufSize

clean

Synchronize the file descriptor's state with the object's state.

fill

Private - Fill the input buffer

flush

Flush the output buffer.

newBuffer

Private - Answer a String to be used as the receiver's buffer

next: n bufferAll: aCollection startingAt: pos

Private - Assuming that the buffer has space for n characters, store n characters of aCollection in the buffer, starting from the pos-th.

nextAvailable: anInteger into: aCollection startingAt: pos

Read up to anInteger bytes from the stream and store them into aCollection. Return the number of bytes read.

nextAvailable: anInteger putAllOn: aStream

Copy up to anInteger bytes from the stream into aStream. Return the number of bytes read.

pendingWrite

Answer whether the output buffer is full.

top


compiling (instance)

segmentFrom: startPos to: endPos
Answer an object that, when sent #asString, will yield the result of sending `copyFrom: startPos to: endPos' to the receiver

top


initialize-release (instance)

initialize
Initialize the receiver's instance variables

top


overriding inherited methods (instance)

next: n putAll: aCollection startingAt: pos
Write n values from aCollection, the first being at pos.

nextLine

Returns a collection of the same type that the stream accesses, containing the next line up to the next new-line character. Returns the entire rest of the stream's contents if no new-line character is found.

nextPutAllOn: aStream

Put all the characters of the receiver in aStream.

upTo: aCharacter

Returns a collection of the same type that the stream accesses, containing data up to aCharacter. Returns the entire rest of the stream's contents if no such character is found.

top


primitive (instance)

fdatasync
Not commented.

fsync

Not commented.

top


testing (instance)

atEnd
Answer whether data has come to an end

top