java.lang.Object
com.levigo.jadice.web.demo.common.client.commands.FileReader

public class FileReader extends Object
A utility class providing different utility methods for reading files via JavaScript.

There are currently two utility methods provided by this class.

  • The method getFileCount returns the number of files contained by the given JavaScript object
  • The method readFile reads the given fill and returns a FileReadrResult containing the file name, the red data, the content type and the size of the file.
  • Constructor Details

    • FileReader

      public FileReader()
  • Method Details

    • getFileCount

      public static int getFileCount(Object e)
      Returns the number of files contained by the given javascript object
      Parameters:
      e - the javascript object containing the file
      Returns:
      the file count
    • readFile

      public static void readFile(Object e, int i, AsyncCallback<FileReader.FileReadResult> callback)
      Reads the specified file and returns the result via the AsyncCallback as a FileReader.FileReadResult.
      Parameters:
      e - the javascript element containing the files
      i - the index of the files inside the list of files contained by the javascript file
      callback - the AsyncCallback to wich the result should be returned