eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'VirtualReadOnlyBinaryFileContents':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: VirtualReadOnlyBinaryFileContents


Inheritance:

   Object
   |
   +--Collection
      |
      +--SequenceableCollection
         |
         +--VirtualArray
            |
            +--VirtualReadOnlyBinaryFileContents

Package:
stx:libbasic2
Category:
Collections-Arrayed
Version:
rev: 1.12 date: 2024/02/23 13:23:46
user: cg
file: VirtualReadOnlyBinaryFileContents.st directory: libbasic2
module: stx stc-classLibrary: libbasic2
Author:
cg

Description:


documentation to be added.

class:
    <a short class summary here, describing what instances represent>

responsibilities:    
    <describing what my main role is>

collaborators:    
    <describing with whom and how I talk to>

API:
    <public api and main messages>
    
example:
    <a one-line examples on how to use - can also be in a separate example method>

implementation:
    <implementation points>


[instance variables:]

[class variables:]


Related information:



Class protocol:

instance creation
o  new
return an initialized instance

o  ofFile: aFilename

o  onStream: aStream


Instance protocol:

accessing
o  binary

o  binary: aBoolean

o  blockSize: anInteger
Modified (format): / 22-02-2024 / 21:49:30 / exept MBP

o  file: aFilename

o  fileStream: something

o  generator: aBlock
(comment from inherited method)
set the element value generator; a block which gets the index as argument

o  offset: newFileOffset
attention: this changes the virtual size

o  offset: newFileOffset size: newSize

o  size: anInteger

collection protocol
o  at: index
(comment from inherited method)
return the element at index.
The value is computed by the generator

o  copyFrom: startIndex to: endIndex
return another virtual array

o  indexOf: anElement startingAt: startIndex ifAbsent: exceptionValue
generator is standard

Usage example(s):

     'abc' indexOf:$d startingAt:0
     'abc' indexOf:$d startingAt:1
     'abc' indexOf:$d startingAt:3
     'abc' indexOf:$d startingAt:4

o  indexOfSubCollection: aCollection startingAt: startIndexArg ifAbsent: exceptionValue
generator is standard

o  write: numBytes into: anExternalWriteStream
hack to speed up file upload of multipart documents in httpServer

initialization
o  initialize
@Commented by exept MBP at: 2024-02-23 07:26 Reason:

o  release
(comment from inherited method)
remove all references to objects that may refer to self.
Subclasses may redefine this method but should do a 'super release'.

private
o  getBlockAt: blockNr

o  readBlock: blockNr

queries
o  species
(comment from inherited method)
return the type of collection to be returned by collect, select etc.


Examples:


|s data bytes1To5 bytes100000To100003|

s := 'libstx_libbasic.dll' asFilename readStream.
bytes1To5 := s nextBytes:5.
s position:100000-1.
bytes100000To100003 := s nextBytes:4.
s close.
Transcript showCR:bytes1To5.
Transcript showCR:bytes100000To100003.

data := VirtualReadOnlyBinaryFileContents ofFile:'libstx_libbasic.dll'.
Transcript show:'1: '; showCR:(data at:1).
Transcript show:'100000: '; showCR:(data at:100000).
Transcript show:'100001: '; showCR:(data at:100001).
Transcript show:'100002: '; showCR:(data at:100002).
Transcript show:'100003: '; showCR:(data at:100003).
Transcript show:'1: '; showCR:(data at:1).
Transcript show:'2: '; showCR:(data at:2).
Transcript show:'3: '; showCR:(data at:3).
Transcript show:'4: '; showCR:(data at:4).
Transcript show:'5: '; showCR:(data at:5).

data offset:100000-1.
Transcript show:'1(100000): '; showCR:(data at:1).
Transcript show:'2(100001): '; showCR:(data at:2).
Transcript show:'3(100002): '; showCR:(data at:3).
Transcript show:'4(100003): '; showCR:(data at:4).

data release


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Thu, 21 Nov 2024 15:31:56 GMT