Back: FilePath-virtual filesystems Up: Base classes Forward: FileSegment class-basic   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.76 FileSegment

Defined in namespace Smalltalk
Superclass: Object
Category: Language-Implementation
My instances represent sections of files. I am primarily used by the compiler to record source code locations. I am not a part of the normal Smalltalk-80 kernel; I am specific to the GNU Smalltalk implementation.

1.76.1 FileSegment class: basic  (class)
1.76.2 FileSegment class: installing  (class)
1.76.3 FileSegment: basic  (instance)
1.76.4 FileSegment: equality  (instance)
1.76.5 FileSegment: printing  (instance)


1.76.1 FileSegment class: basic

on: aFile startingAt: startPos for: sizeInteger
Create a new FileSegment referring to the contents of the given file, from the startPos-th byte and for sizeInteger bytes. Note that FileSegments should always be created with full paths because relative paths are interpreted to be relative to the kernel directory.


1.76.2 FileSegment class: installing

relocate
Remove the kernel path from all paths that start with it. Needed to support $(DESTDIR) and relocatable installation.


1.76.3 FileSegment: basic

asString
Answer a String containing the required segment of the file

copyFrom: from to: to
Answer a String containing the given subsegment of the file. As for streams, from and to are 0-based.

file
Answer the File object for the file containing the segment

fileName
Answer the name of the file containing the segment

filePos
Answer the position in the file where the segment starts

relocateFrom: startPath map: map
If the path starts with startPath, remove that part of the path. map is a Dictionary that is used so that equal filenames stay equal, without increasing the amount of memory that the image uses.

size
Answer the length of the segment

withFileDo: aBlock
Evaluate aBlock passing it the FileStream in which the segment identified by the receiver is stored


1.76.4 FileSegment: equality

= aFileSegment
Answer whether the receiver and aFileSegment are equal.

hash
Answer an hash value for the receiver.


1.76.5 FileSegment: printing

printedFileName
Answer a printed representation of the file containing the segment. While introducing some ambiguity, this representation is compact eliminates the path for kernel files, and produces a relative path from the current working directory for other files.



Back: FileSegment-equality Up: FileSegment Forward: FileStream   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on August, 19 2010 using texi2html