Package net.sourceforge.uiq3.fa6
Class Tape
- java.lang.Object
-
- net.sourceforge.uiq3.fx603p.Interface
-
- net.sourceforge.uiq3.fa6.Tape
-
-
Field Summary
Fields Modifier and Type Field Description (package private) String
File_Name
Last file name created or opened.protected long
File_Read
Characters read from input streamprotected @Nullable String
Home_Directory
The simulators home directory.private DataInputStream
In
input streamint[]
Last_Header
No CASIO style filename to embed into the headerprivate static Logger
Logger
class Logger instanceprivate static int
MF_Divisor
static String
No_Name
File name for files without name or number.private DataOutputStream
Out
output streamprivate Calculator
Owner
Calculator to which the interface is connected tostatic String
Setting_Name
File name for settings.private static String
TAG
Class logger tag.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Tape(Calculator Owner)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
Close()
Close files and all streams attached to them.void
Create(Interface.File_Type Type, String File_Name, int[] Casio_File_Name, int Header)
create new file for tape IOprotected abstract DataOutputStream
Create_Stream(@NotNull String Filename)
Create a new file for output.abstract long
File_Size()
Get file Size@NotNull String
Home_Directory()
The simulators home directory.void
Home_Directory(@Nullable String Home_Directory)
The simulators home directory.Interface.File_Type
Open(@NotNull String File_Name)
open file and return typevoid
Open(Interface.File_Type Type, @NotNull String File_Name)
open file of given typeprotected abstract DataInputStream
Open_Stream(@NotNull String Filename)
Create a new file for input.int
Read()
Read one byte from the simulated cassette interface.int @NotNull []
Read(int size)
Read a few byte from the simulated tape interface.int
Read_Alpha(short @NotNull [] Out_Text)
Read Display from Simulated Cassette interface.private Number
Read_BCD()
Number
Read_Display(short @NotNull [] Out_Text)
Read Display from Simulated Cassette interface.void
Read_EOF()
Read over an EOF maker to the next value.void
Read_M()
Read M register from filevoid
Read_Steps()
Read Steps from Simulated Cassette interface.@NotNull String
toString()
void
Write(int Data)
Write one byte to the simulated cassette interface.void
Write(int @NotNull [] Data)
writes the bytes in the array to the interface.void
Write(short @NotNull [] Data)
writes the bytes in the array to the interface.void
Write_Alpha(short @NotNull [] Print)
Print displayed alpha text to simulated printer (max 40 characters)void
Write_Display(Number L_X, short @NotNull [] Text)
Writes displayed register to simulated cassette interface.void
Write_EOF()
Writes an EOF marker into the file.void
Write_M()
Writes memory register to simulated cassette interface.-
Methods inherited from class net.sourceforge.uiq3.fx603p.Interface
Convert_To_Alpha, Convert_To_Java, Convert_To_Java, Convert_To_Java, Convert_To_Token, Is_Enabled, Set_Enable
-
-
-
-
Field Detail
-
Logger
private static final Logger Logger
class Logger instance
-
MF_Divisor
private static final int MF_Divisor
- See Also:
- Constant Field Values
-
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
-
Owner
private final Calculator Owner
Calculator to which the interface is connected to
-
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-603P/"
- OS X
- "/User/user_id/FX-603P/"
- Unix
- "/home/user_id/FX-603P/"
- Symbian
- "D:/others/FX-603P/"
- Android
- "/mnt/sdcard/Android/data/net.sourceforge.uiq3.fx603p"
-
Last_Header
public int[] Last_Header
No CASIO style filename to embed into the header
-
-
Constructor Detail
-
Tape
protected Tape(Calculator Owner)
- Parameters:
Owner
- Calculator to which the interface is connected to
-
-
Method Detail
-
Close
public void Close() throws Op_Error
Close 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
create new file for tape IO
- Parameters:
Type
- File Type.File_Name
- file name to createCasio_File_Name
- file name to embedd inside the file headerHeader
- header to write- 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_Error
Get file Size- Returns:
- File size
- Throws:
Op_Error
- any file io error
-
Home_Directory
@NotNull public @NotNull String Home_Directory()
The simulators home directory. The usual positions are:- Windows
- "C:/Documents and Settings/user_id/FX-603P/"
- OS X
- "/User/user_id/FX-603P/"
- Unix
- "/home/user_id/FX-603P/"
- Symbian
- "D:/others/FX-603P/"
- Android
- "/mnt/sdcard/Android/data/net.sourceforge.uiq3.fx603p/"
- 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-603P/"
- OS X
- "/User/user_id/FX-603P/"
- Unix
- "/home/user_id/FX-603P/"
- Symbian
- "D:/others/FX-603P/"
- Android
- "/mnt/sdcard/Android/data/net.sourceforge.uiq3.fx603p/"
- Parameters:
Home_Directory
- The home directory to be used.
-
Open
public void Open(@NotNull Interface.File_Type Type, @NotNull @NotNull String File_Name) throws Op_Error
open 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_Error
Read 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_Error
Read 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_Alpha
public int Read_Alpha(short @NotNull [] Out_Text) throws Op_Error
Read Display from Simulated Cassette interface.- Returns:
- amount of characters read.
- Throws:
Op_Error
- I/O Error
-
Read_Display
public Number Read_Display(short @NotNull [] Out_Text) throws Op_Error
Read Display from Simulated Cassette interface.- Throws:
Op_Error
- I/O Error
-
Read_EOF
public void Read_EOF() throws Op_Error
Read over an EOF maker to the next value.- Throws:
Op_Error
- any kind of IO error
-
Read_Steps
public void Read_Steps() throws Op_Error
Read Steps from Simulated Cassette interface.- Throws:
Op_Error
- I/O error
-
Write
public void Write(int Data) throws Op_Error
Write 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_Error
writes 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
public void Write(short @NotNull [] Data) throws Op_Error
writes 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_Alpha
public void Write_Alpha(short @NotNull [] Print) throws Op_Error
Print displayed alpha text to simulated printer (max 40 characters)- Parameters:
Print
- Alpha Text- Throws:
Op_Error
- something went wrong
-
Write_Display
public void Write_Display(@NotNull Number L_X, short @NotNull [] Text) throws Op_Error
Writes displayed register to simulated cassette interface.- Parameters:
L_X
- X RegisterText
- Alpha Text- Throws:
Op_Error
- could mot save the display
-
Write_EOF
public void Write_EOF() throws Op_Error
Writes an EOF marker into the file.- Throws:
Op_Error
- any kind of IO error
-
Write_M
public void Write_M() throws Op_Error
Writes memory register to simulated cassette interface.- Throws:
Op_Error
- an calculator error
-
-