lejos.nxt
Class FileSystem

java.lang.Object
  extended by lejos.nxt.FileSystem

public class FileSystem
extends java.lang.Object

Support for remote file operations

Author:
Brian Bagnall

Method Summary
static byte delete(java.lang.String fileName)
          Delete a file from the NXT.
static byte[] download(java.lang.String fileName)
           
static byte download(java.lang.String fileName, java.io.File destination)
          Download a file from the NXT and save it to a file.
static byte download(java.lang.String fileName, java.lang.String destination)
          Download a file from the NXT and save it to a local directory.
static java.lang.String getCurrentProgramName()
          Retrieves the file name of the Lego executable currently running on the NXT.
static java.lang.String[] getFileNames()
          Returns a list of all files on NXT brick.
static java.lang.String[] getFileNames(java.lang.String searchCriteria)
          Returns a list of files on NXT brick.
static byte startProgram(java.lang.String fileName)
          Starts a Lego executable file on the NXT.
static byte stopProgram()
          Stops the currently running Lego executable on the NXT.
static byte upload(java.io.File localSource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

upload

public static byte upload(java.io.File localSource)

download

public static byte[] download(java.lang.String fileName)
Parameters:
fileName - The name of the file on the NXT, including filename extension.
Returns:
The file data, as an array of bytes. If there is a problem, the array will contain one byte with the error code.

download

public static byte download(java.lang.String fileName,
                            java.io.File destination)
Download a file from the NXT and save it to a file.

Parameters:
fileName -
destination - Where the file will be saved. Can be directory or full path and filename.
Returns:
Error code.

download

public static byte download(java.lang.String fileName,
                            java.lang.String destination)
Download a file from the NXT and save it to a local directory.

Parameters:
fileName -
destination - Where the file will be saved. Can be directory or full path and filename. e.g. "c:/Documents/Lego Sounds/Sir.rso"
Returns:
Error code.

delete

public static byte delete(java.lang.String fileName)
Delete a file from the NXT.

Parameters:
fileName -
Returns:
0 = success

getFileNames

public static java.lang.String[] getFileNames()
Returns a list of all files on NXT brick.

Returns:
An array on file names, or NULL if no files found.

getFileNames

public static java.lang.String[] getFileNames(java.lang.String searchCriteria)
Returns a list of files on NXT brick.

Parameters:
searchCriteria - "*.*" or [FileName].* or or *.[Extension] or [FileName].[Extension]
Returns:
An array on file names, or NULL if nothing found.

getCurrentProgramName

public static java.lang.String getCurrentProgramName()
Retrieves the file name of the Lego executable currently running on the NXT.

Returns:
the status

startProgram

public static byte startProgram(java.lang.String fileName)
Starts a Lego executable file on the NXT.

Parameters:
fileName -
Returns:
the status

stopProgram

public static byte stopProgram()
Stops the currently running Lego executable on the NXT.

Returns:
the status