Class MapBytes

Summary

Efficiently rearrange bytes in a string. This is a class so that multiple simultaneous rearrangements can be carried out efficiently. Use a different class instance for each different rearrangement.

Handles any transposition that can be expressed in multiples of 256-bytes or less.

Superclasses:
Object

Package:
util
File:
mapbytes.icn
Methods:
adjBlockSize, mapIn, mapInFile, mapOut, mapOutFile

Methods inherited from Object:
Type, className, clone, equals, fieldNames, genMethods, getField, get_class, get_class_name, get_id, hasField, hasMethod, hash_code, instanceOf, invoke, is_instance, setField, to_string

Fields:
blkSize, inM, inMap, outM, outMap

Source code.

Details
Constructor

MapBytes(in, out, blockSize)

Parameters:
in
Arrangement of bytes found in input string
out
Rearrangement of those bytes for output string
blockSize
Default size of file read/write operations (bytes). <i>Adjusted automatically to be a multiple of *in</i>.

Create a class instance suitable for transposing bytes in in a string. Efficiently handles large strings.

Methods:

adjBlockSize(blockSize)

Parameter:
blockSize
desired block size, may be adjusted internally
Returns:
adjusted block size

Adjust the given blockSize for file reads() to a valid value. Used internally.


mapIn(s:"")

Parameter:
s
string to be transposed by map
Returns:
a copy of s with the bytes rearranged by map


mapInFile(inFile, outFile, blockSize)

Parameters:
inFile
Input file (already opened for reading)
outFile
Output file (already opened for writing)
blockSize
If present, overrides class' blkSize

Copy one file to another with mapping (leaves files open).


mapOut(s:"")

Parameter:
s
string to be transposed by map inverse
Returns:
a copy of s with the bytes rearranged by map inverse

Reverse the byte rearrangement


mapOutFile(inFile, outFile, blockSize)

Parameters:
inFile
Input file (already opened for reading)
outFile
Output file (already opened for writing)
blockSize
If present, overrides class' blkSize

Copy one file to another with reverse mapping (leaves files open)


Fields:
blkSize

inM

inMap

outM

outMap


This page produced by UniDoc on 2021/04/15 @ 23:59:53.