com.webcodepro.applecommander.storage.filters
Class PascalTextFileFilter

java.lang.Object
  extended by com.webcodepro.applecommander.storage.filters.PascalTextFileFilter
All Implemented Interfaces:
FileFilter

public class PascalTextFileFilter
extends java.lang.Object
implements FileFilter

Filter the given file as a Pascal ".text" file.

From the Apple Pascal v1.2 Operating System Reference manual: Text files in Apple Pascal


At the beginning of each textfile is a 1024-byte (two blocks on diskette) header page, which contains information for the texteditor. This space is reserved for use by the text editor, and is respected by all portions of the system. When a user program opens a text file, and REWRITEs or RESETs it with a title ending in .TEXT, the I/O subsystem will create and skip over the initial header page. This is done to faciliatie users editing their input and/or output data. The file-handler wil transfer the header page only on a disk-to-disk transfer, and will omit it on a transfer to a serial device (thus transfers to PRINTER: abd CONSOLE: will omit the header page).

Following the initial header page, the text itself appears in subsequent 1024-byte text pages (two block each, on diskette), where a text page is defined:

     [DLE] [indent] [text] [cr] [dle] [indent] [text] [CR] .. [nulls]
 
DLE's (Data Link Escapes) are followed by an indent-code, which is a byte containing the value 32+(number to indent). The nulls at the end of the page follow a [CR} in all cases, and are a pad to the end of a 1024-byte page (because the compiler wants integral numbers of lines on a page). The Data Link Escape and corresponding indentation code are optional. In a given text file, some lines will have the codes, and some won't. (Thanks to Hans Otten for sending in this information.)

Author:
Rob Greene

Constructor Summary
PascalTextFileFilter()
          Constructor for PascalTextFileFilter.
 
Method Summary
 byte[] filter(FileEntry fileEntry)
          Process the given FileEntry and return a byte array with filtered data; use PrintWriter to get platform agnostic line endings.
 java.lang.String getSuggestedFileName(FileEntry fileEntry)
          Give suggested file name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PascalTextFileFilter

public PascalTextFileFilter()
Constructor for PascalTextFileFilter.

Method Detail

filter

public byte[] filter(FileEntry fileEntry)
Process the given FileEntry and return a byte array with filtered data; use PrintWriter to get platform agnostic line endings.

Specified by:
filter in interface FileFilter

getSuggestedFileName

public java.lang.String getSuggestedFileName(FileEntry fileEntry)
Give suggested file name.

Specified by:
getSuggestedFileName in interface FileFilter