Package net.sourceforge.uiq3.fa2
Class Tape
- java.lang.Object
-
- net.sourceforge.uiq3.fx602p.Interface
-
- net.sourceforge.uiq3.fa2.Tape
-
-
Field Summary
Fields Modifier and Type Field Description (package private) StringFile_NameLast file name created or opened.protected longFile_ReadCharacters read from input streamprotected @Nullable StringHome_DirectoryThe simulators home directory.private DataInputStreamIninput streamint[]Last_HeaderNo CASIO style filename to embed into the headerprivate static LoggerLoggerClass logger instance.static StringNo_NameFile name for files without name or number.private DataOutputStreamOutoutput streamstatic StringSetting_NameFile name for settings.private static StringTAGClass logger tag.
-
Constructor Summary
Constructors Constructor Description Tape()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidClose()Close files and all streams attached to them.voidCreate(Interface.File_Type Type, String File_Name, int[] Casio_File_Name, int Header)protected abstract DataOutputStreamCreate_Stream(@NotNull String Filename)Create a new file for output.abstract longFile_Size()Get file SizelongGet_File_Read()Get amount of bytes read from file@NotNull StringHome_Directory()The simulators home directory.voidHome_Directory(@Nullable String Home_Directory)The simulators home directory.Interface.File_TypeOpen(@NotNull String File_Name)open file and return typevoidOpen(Interface.File_Type Type, String File_Name)open file of given typeprotected abstract DataInputStreamOpen_Stream(@NotNull String Filename)Create a new file for input.intRead()Read one byte from the simulated cassette interface.int @NotNull []Read(int size)Read a few byte from the simulated tape interface.voidRead_EOF()Read over an EOF maker to the next value.@NotNull StringtoString()voidWrite(int Data)Write one byte to the simulated cassette interface.voidWrite(int @NotNull [] Data)writes the bytes in the array to the interface.voidWrite_EOF()Writes an EOF marker into the file.-
Methods inherited from class net.sourceforge.uiq3.fx602p.Interface
Convert_To_Java, Convert_To_Java, Enable, Is_Enabled
-
-
-
-
Field Detail
-
Logger
private static final Logger Logger
Class logger instance.
-
TAG
private static final String TAG
Class logger tag.
-
No_Name
public static final String No_Name
File name for files without name or number.- See Also:
- Constant Field Values
-
Setting_Name
public static final String Setting_Name
File name for settings.- See Also:
- Constant Field Values
-
In
@Nullable private DataInputStream In
input stream
-
Out
@Nullable private DataOutputStream Out
output stream
-
File_Name
String File_Name
Last file name created or opened. Remembered to improve error messages.
-
File_Read
protected long File_Read
Characters read from input stream
-
Home_Directory
@Nullable protected @Nullable String Home_Directory
The simulators home directory. The usual positions are:- Windows
- "C:/Documents and Settings/user_id/FX-602P/"
- OS X
- "/User/user_id/FX-602P/"
- Unix
- "/home/user_id/FX-602P/"
- Symbian
- "D:/others/FX-602P/"
- Android
- "/mnt/sdcard/Android/data/net.sourceforge.uiq3.fx602p"
-
Last_Header
public int[] Last_Header
No CASIO style filename to embed into the header
-
-
Method Detail
-
Close
public void Close() throws Op_ErrorClose files and all streams attached to them.- Throws:
Op_Error- Something went wrong
-
Create
public void Create(@NotNull Interface.File_Type Type, String File_Name, int[] Casio_File_Name, int Header) throws Op_Error- Parameters:
Type- File Type.File_Name- file name to createCasio_File_Name- file name to embed inside the file headerHeader-- Throws:
Op_Error- Something went wrong
-
Create_Stream
@Nullable protected abstract DataOutputStream Create_Stream(@NotNull @NotNull String Filename) throws Op_Error
Create a new file for output.- Parameters:
Filename- filename.- Returns:
- data stream to write to.
- Throws:
Op_Error- io error.
-
File_Size
public abstract long File_Size() throws Op_ErrorGet file Size- Returns:
- File size
- Throws:
Op_Error- any file io error
-
Get_File_Read
public long Get_File_Read()
Get amount of bytes read from file- Returns:
- Bytes read
-
Home_Directory
@NotNull public @NotNull String Home_Directory()
The simulators home directory. The usual positions are:- Windows
- "C:/Documents and Settings/user_id/FX-602P/"
- OS X
- "/User/user_id/FX-602P/"
- Unix
- "/home/user_id/FX-602P/"
- Symbian
- "D:/others/FX-602P/"
- Android
- "/mnt/sdcard/Android/data/net.sourceforge.uiq3.fx602p/"
- Returns:
- The home directory to be used.
-
Home_Directory
public void Home_Directory(@Nullable @Nullable String Home_Directory)The simulators home directory. The usual positions are:- Windows
- "C:/Documents and Settings/user_id/FX-602P/"
- OS X
- "/User/user_id/FX-602P/"
- Unix
- "/home/user_id/FX-602P/"
- Symbian
- "D:/others/FX-602P/"
- Android
- "/mnt/sdcard/Android/data/net.sourceforge.uiq3.fx602p/"
- Parameters:
Home_Directory- The home directory to be used.
-
Open
public void Open(@NotNull Interface.File_Type Type, String File_Name) throws Op_Erroropen file of given type
- Parameters:
Type- File Type.File_Name- File name to open- Throws:
Op_Error- Something went wrong
-
Open
@NotNull public Interface.File_Type Open(@NotNull @NotNull String File_Name) throws Op_Error
open file and return type
- Parameters:
File_Name- File name to open- Returns:
- the file type of the file
- Throws:
Op_Error- Something went wrong
-
Open_Stream
@Nullable protected abstract DataInputStream Open_Stream(@NotNull @NotNull String Filename) throws Op_Error
Create a new file for input.- Parameters:
Filename- filename.- Returns:
- data stream to read from.
- Throws:
Op_Error- io error.
-
Read
public int Read() throws Op_ErrorRead one byte from the simulated cassette interface. Don't be fooled by the return Type - it's just because the Java byte Type has a silly -128 .. 127 range.- Returns:
- byte array
- Throws:
Op_Error- any kind of IO error
-
Read
public int @NotNull [] Read(int size) throws Op_ErrorRead a few byte from the simulated tape interface. Don't be fooled by the return Type - it's just because the Java byte Type has a silly -128 .. 127 range.- Parameters:
size- amount of bytes to be read- Returns:
- byte array
- Throws:
Op_Error- any kind of IO error
-
Read_EOF
public void Read_EOF() throws Op_ErrorRead over an EOF maker to the next value.- Throws:
Op_Error- any kind of IO error
-
Write
public void Write(int Data) throws Op_ErrorWrite one byte to the simulated cassette interface. Don't be fooled by the parameter Type - it's just because the Java byte Type has a silly -128 .. 127 range.- Parameters:
Data- a byte- Throws:
Op_Error- any kind of IO error
-
Write
public void Write(int @NotNull [] Data) throws Op_Errorwrites the bytes in the array to the interface. Note that the Java designers in there great wisdom defined a byte as -128..128 - while in 99% of all cases one need 0..255. Hence we use a int array to pass bytes. As an Ada advocate this mistreatment of data types gives me pimples.- Parameters:
Data- byte array- Throws:
Op_Error- any kind of IO error
-
Write_EOF
public void Write_EOF() throws Op_ErrorWrites an EOF marker into the file.- Throws:
Op_Error- any kind of IO error
-
-