示例#1
0
        public void getFile(int user, String name, Stream os)
        {
            CpmFile file   = searchFileException(user, name);
            int     length = getFileSize(file) * 128;

            //System.out.println("name "+name+" size "+file.size+" block "+file.getBlockCount()+" r "+file.record);
            for (int i = 0; i < file.GetBlockCount( ); i++)
            {
                readBlock(file.GetBlockAt(i), block);
                int count = getBlockSize( );
                if (length < count)
                {
                    count = length;
                }

                os.Write(block, 0, count);

                length -= count;
            }
        }
示例#2
0
        public void deleteFile(int user, String name)
        {
            CpmFile file = searchFileException(user, name);

            for (int i = 0; i < file.GetBlockCount( ); i++)
            {
                //System.out.println("Free block "+file.getBlockAt(i));
                blockUsed[file.GetBlockAt(i)] = false;
            }

            FCB fcb = new FCB( );

            for (int i = 0; i < file.GetFCBCount( ); i++)
            {
                int entry = file.GetFCBAt(i);
                //System.out.println("free FCB "+entry);
                readFCB(entry, fcb);
                fcb.SetDeleted( );
                writeFCB(entry, fcb);
                directoryUsed[entry] = false;
            }

            files.Remove(file);
        }