com.alarexgroup.m2mplf.file
Class Folder

java.lang.Object
  extended by com.alarexgroup.m2mplf.file.Folder
public class Folder
extends java.lang.Object

This class works with file system.
Enables to go through directory content and to find information about single records.

Example:

import com.alarexgroup.m2mplf.M2Mlet;
import com.alarexgroup.m2mplf.file.Folder;
import com.alarexgroup.m2mplf.logging.Logger;

public class FolderExample extends M2Mlet{
    
    public FolderExample() {
    }

    public void appStop(boolean unconditional) {
    }

    public void appStart() {
        //opens a directory and lists it's files and directories (analogy to cmd dir)
        Folder f = Folder.openFolder("a:/tmp/");
        while(f.nextItem()){
            Logger.logInfo(f.getPath()+f.getName()+" "+f.size());
        }
        f.close();
        //creating a subdirectory
        Folder.createFolder("a:/tmp/subdir");     
    }

    public void appPause() {
    }
    
}

Constructor Summary
Folder()
           
 
Method Summary
 long avaiable()
          Available place in v file system
 void close()
          Finish work with folder
static boolean createFolder(java.lang.String fullPath)
          Creates directory in parameter.
static boolean deleteFolder(java.lang.String fullPath)
          Ereases folder in paramenter.
 java.lang.String getName()
          Returns item in folder obtained by nextItem()
 java.lang.String getPath()
          Returns path to item obtained by nextItem()
 boolean isFolder()
          Test if the item was obtained by nextItem() folder.
 boolean isHidden()
          Tests if the item was set as hidden
 boolean isReadable()
          Tests if the item was set as readable
 boolean isWriteable()
          Tests if the item was set as writable.
 boolean nextItem()
          This function sets the pointer on next item in folder.
static Folder openFolder(java.lang.String fullPath)
          Opens directory in parameter for content location.
 long size()
          Returns size of item.
 long total()
          Total folder size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Folder

public Folder()
Method Detail

openFolder

public static Folder openFolder(java.lang.String fullPath)
Opens directory in parameter for content location.

Parameters:
fullPath - Full path and name of directory for example: a:/folder1/ nebo a:/
Returns:
Objekt Folder

nextItem

public boolean nextItem()
This function sets the pointer on next item in folder.

Returns:
true ... next item in folder false ... next item in folder doesn't exist.

getName

public java.lang.String getName()
Returns item in folder obtained by nextItem()

Returns:
item name

getPath

public java.lang.String getPath()
Returns path to item obtained by nextItem()

Returns:
path to item

isHidden

public boolean isHidden()
Tests if the item was set as hidden

Returns:
true - hidden

isWriteable

public boolean isWriteable()
Tests if the item was set as writable.

Returns:
true - writeable

isReadable

public boolean isReadable()
Tests if the item was set as readable

Returns:
true - readable

size

public long size()
Returns size of item.

Returns:
size

total

public long total()
Total folder size

Returns:
total size

avaiable

public long avaiable()
Available place in v file system

Returns:
dostupné místo

isFolder

public boolean isFolder()
Test if the item was obtained by nextItem() folder.

Returns:
true - item is FOLDER

createFolder

public static boolean createFolder(java.lang.String fullPath)
Creates directory in parameter.

Parameters:
fullPath - name of directory - includes path
Returns:
true - success

deleteFolder

public static boolean deleteFolder(java.lang.String fullPath)
Ereases folder in paramenter.

Parameters:
fullPath - to folder
Returns:
true - success

close

public void close()
Finish work with folder