jmce - 1_02

jmce.sim.cpm
Class CpmDisk

java.lang.Object
  extended by jmce.sim.cpm.CpmDisk

public class CpmDisk
extends java.lang.Object

CP/M File system implementation.

Simple implementation of the CP/M file system. This class permit to format a CP/M disk and read,write and delete one file from the disk.

This version work only for disk with DPB.exm == 0.

Version:
1.02
Author:
Mario Viara

Constructor Summary
CpmDisk(DPB dpb, Disk disk)
          Constructor.
 
Method Summary
 void deleteFile(int user, java.lang.String name)
           
 void format()
          Format the disk with the CP/M file system
 void getFile(CpmFile file, java.io.OutputStream os)
           
 void getFile(CpmFile file, java.lang.String name)
           
 void getFile(int user, java.lang.String name, java.io.OutputStream os)
           
 void getFile(int user, java.lang.String name, java.lang.String to)
           
 CpmFile getFileAt(int index)
           
 int getFileCount()
           
 int getFileSize(CpmFile file)
           
 int getNumBlockUsed()
           
 int getNumDirBlock()
           
 int getNumDirectoryUsed()
           
 int getRecordForFCB()
           
 void mount()
           
 void putFile(int user, java.lang.String name, java.io.InputStream is)
           
 void readBlock(int block, byte[] buffer)
           
 void readSector(int secno, byte[] buffer)
           
 void readSector(int track, int sector, byte[] buffer)
           
 void stat()
           
 void stat(java.lang.String name, int value, java.lang.String unit)
           
 java.lang.String toString()
           
 void umount()
           
 void writeBlock(int block, byte[] buffer)
           
 void writeSector(int secno, byte[] buffer)
           
 void writeSector(int track, int sector, byte[] buffer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CpmDisk

public CpmDisk(DPB dpb,
               Disk disk)
Constructor.

Parameters:
dpb - - Disk parametar block
disk - - Phisical disk
Method Detail

format

public void format()
            throws java.lang.Exception
Format the disk with the CP/M file system

Throws:
java.lang.Exception

getFileAt

public CpmFile getFileAt(int index)

getFileCount

public int getFileCount()

writeSector

public void writeSector(int secno,
                        byte[] buffer)
                 throws java.lang.Exception
Throws:
java.lang.Exception

writeSector

public void writeSector(int track,
                        int sector,
                        byte[] buffer)
                 throws java.lang.Exception
Throws:
java.lang.Exception

readSector

public void readSector(int track,
                       int sector,
                       byte[] buffer)
                throws java.lang.Exception
Throws:
java.lang.Exception

readSector

public void readSector(int secno,
                       byte[] buffer)
                throws java.lang.Exception
Throws:
java.lang.Exception

getNumDirBlock

public int getNumDirBlock()

mount

public void mount()
           throws java.lang.Exception
Throws:
java.lang.Exception

getNumBlockUsed

public int getNumBlockUsed()

getNumDirectoryUsed

public int getNumDirectoryUsed()

stat

public void stat(java.lang.String name,
                 int value,
                 java.lang.String unit)

stat

public void stat()

readBlock

public void readBlock(int block,
                      byte[] buffer)
               throws java.lang.Exception
Throws:
java.lang.Exception

writeBlock

public void writeBlock(int block,
                       byte[] buffer)
                throws java.lang.Exception
Throws:
java.lang.Exception

getRecordForFCB

public int getRecordForFCB()

putFile

public void putFile(int user,
                    java.lang.String name,
                    java.io.InputStream is)
             throws java.lang.Exception
Throws:
java.lang.Exception

getFileSize

public int getFileSize(CpmFile file)
                throws java.lang.Exception
Throws:
java.lang.Exception

getFile

public void getFile(int user,
                    java.lang.String name,
                    java.lang.String to)
             throws java.lang.Exception
Throws:
java.lang.Exception

getFile

public void getFile(int user,
                    java.lang.String name,
                    java.io.OutputStream os)
             throws java.lang.Exception
Throws:
java.lang.Exception

getFile

public void getFile(CpmFile file,
                    java.lang.String name)
             throws java.lang.Exception
Throws:
java.lang.Exception

getFile

public void getFile(CpmFile file,
                    java.io.OutputStream os)
             throws java.lang.Exception
Throws:
java.lang.Exception

deleteFile

public void deleteFile(int user,
                       java.lang.String name)
                throws java.lang.Exception
Throws:
java.lang.Exception

umount

public void umount()
            throws java.lang.Exception
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

jmce - 1_02