|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttapeutils.zx81.PFile
This class provides utilities that act on the contents of a .P file.
It is possible to list the contents, play as a tape signal, or save the tape signal to a sampled sound file.
Constructor Summary | |
---|---|
PFile(byte[] fileBytes,
java.lang.String programName)
Construct the .P file from a byte array of the file's contents. |
|
PFile(java.io.File file,
java.lang.String programName)
Construct from a file. |
Method Summary | |
---|---|
byte |
getByte(int index)
Returns a byte from the file content. |
byte[] |
getBytes()
Returns all the bytes in the file content. |
int |
getDisplayEndOffset()
Get the offset in the file of the end of the display. |
int |
getProgramEndOffset()
Get the offset in the file of the end of the program. |
int |
getTotalFileLength()
Get the total length of the file, according to the system variable values. |
void |
list(boolean outputSystem,
boolean outputVariables,
boolean outputDisplay,
boolean dumpNumberValues)
List the requested parts of the file. |
java.lang.String |
listDisplay(boolean print)
List the display. |
java.lang.String |
listProgram(boolean print,
boolean dumpNumberValues)
List the program. |
java.lang.String |
listSystemVariables(boolean print)
Get the system variables. |
java.lang.String |
listVariables(boolean print)
List the program variables. |
void |
play(float frequency,
boolean squareWave)
Play the contents of the .P file as a sound sample. |
void |
write(java.io.OutputStream output)
Write the contents of the .P file to the output stream. |
void |
writeSampleToFile(float frequency,
java.io.File sampleFile,
boolean squareWave)
Write the contents of the .P file as a sound sample. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PFile(java.io.File file, java.lang.String programName) throws java.io.IOException
The program name is required as it is not in the .P file itself.
file
- The file.programName
- The name of the program.
java.io.IOException
- An error occurred reading from the file.public PFile(byte[] fileBytes, java.lang.String programName)
The program name is required as it is not in the .P file itself.
fileBytes
- The file bytes.programName
- The name of the program.Method Detail |
public void list(boolean outputSystem, boolean outputVariables, boolean outputDisplay, boolean dumpNumberValues)
outputSystem
- Indicates whether to output system variables.outputVariables
- Indicates whether to output program variables.outputDisplay
- Indicates whether to output the display.dumpNumberValues
- Indicates whether to dump number values in BASIC listing.public java.lang.String listSystemVariables(boolean print)
print
-
public java.lang.String listProgram(boolean print, boolean dumpNumberValues)
print
- dumpNumberValues
- Indicates whether to dump number values.
public java.lang.String listDisplay(boolean print)
print
-
public java.lang.String listVariables(boolean print)
print
-
public int getTotalFileLength()
public int getProgramEndOffset()
public int getDisplayEndOffset()
public void write(java.io.OutputStream output) throws java.io.IOException
output
- The output stream.
java.io.IOException
- An error occurred writing to the stream.public byte getByte(int index)
index
- The index of the byte.
public byte[] getBytes()
public void writeSampleToFile(float frequency, java.io.File sampleFile, boolean squareWave) throws java.io.IOException
The format of the sample is determined by the file extension.
frequency
- The sample frequency.sampleFile
- The sample file.squareWave
- Indicates whether to use a square wave.
java.io.IOException
- An error occurred writing the sample file.public void play(float frequency, boolean squareWave) throws javax.sound.sampled.LineUnavailableException
frequency
- The sample frequency.squareWave
- Indicates whether to use a square wave.
javax.sound.sampled.LineUnavailableException
- The resources are not available to play the sound.
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |