com.jmatio.io
Class MatFileReader

java.lang.Object
  extended by com.jmatio.io.MatFileReader

public class MatFileReader
extends Object

Author:
Wojciech Gradkowski (wgradkowski@gmail.com)

Field Summary
static int DIRECT_BYTE_BUFFER
           
static int HEAP_BYTE_BUFFER
           
static int INFLATER_BUFFER_SIZE
           
static int MEMORY_MAPPED_FILE
           
 
Constructor Summary
MatFileReader()
           
MatFileReader(File file)
          Creates instance of MatFileReader and reads MAT-file from file.
MatFileReader(File file, boolean allocate)
          Creates instance of MatFileReader and reads MAT-file from file.
MatFileReader(File file, MatFileFilter filter)
          Creates instance of MatFileReader and reads MAT-file from file.
MatFileReader(File file, MatFileFilter filter, boolean allocate)
           
MatFileReader(String fileName)
          Creates instance of MatFileReader and reads MAT-file from location given as fileName.
MatFileReader(String fileName, boolean allocate)
          Creates instance of MatFileReader and reads MAT-file from location given as fileName.
MatFileReader(String fileName, MatFileFilter filter)
           
MatFileReader(String fileName, MatFileFilter filter, boolean allocate)
          Creates instance of MatFileReader and reads MAT-file from location given as fileName.
 
Method Summary
 void dispose()
           
 Map<String,MLArray> getContent()
          Returns a map of MLArray objects that were inside MAT-file.
 MatFileHeader getMatFileHeader()
          Gets MAT-file header
 MLArray getMLArray(String name)
          Returns the value to which the red file maps the specified array name.
 Map<String,MLArray> read(File file)
          Reads the content of a MAT-file and returns the mapped content.
 Map<String,MLArray> read(File file, int policy)
          Reads the content of a MAT-file and returns the mapped content.
 Map<String,MLArray> read(File file, MatFileFilter filter, int policy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INFLATER_BUFFER_SIZE

public static final int INFLATER_BUFFER_SIZE
See Also:
Constant Field Values

MEMORY_MAPPED_FILE

public static final int MEMORY_MAPPED_FILE
See Also:
Constant Field Values

DIRECT_BYTE_BUFFER

public static final int DIRECT_BYTE_BUFFER
See Also:
Constant Field Values

HEAP_BYTE_BUFFER

public static final int HEAP_BYTE_BUFFER
See Also:
Constant Field Values
Constructor Detail

MatFileReader

public MatFileReader(String fileName)
              throws FileNotFoundException,
                     IOException
Creates instance of MatFileReader and reads MAT-file from location given as fileName. This method reads MAT-file without filtering.

Parameters:
fileName - the MAT-file path String
Throws:
IOException - when error occurred while processing the file.
FileNotFoundException

MatFileReader

public MatFileReader(String fileName,
                     boolean allocate)
              throws FileNotFoundException,
                     IOException
Creates instance of MatFileReader and reads MAT-file from location given as fileName. This method reads MAT-file without filtering.

Parameters:
fileName - the MAT-file path String
Throws:
IOException - when error occurred while processing the file.
FileNotFoundException

MatFileReader

public MatFileReader(String fileName,
                     MatFileFilter filter,
                     boolean allocate)
              throws IOException
Creates instance of MatFileReader and reads MAT-file from location given as fileName. Results are filtered by MatFileFilter. Arrays that do not meet filter match condition will not be available in results.

Parameters:
fileName - the MAT-file path String
MatFileFilter - array name filter.
Throws:
IOException - when error occurred while processing the file.

MatFileReader

public MatFileReader(File file,
                     boolean allocate)
              throws IOException
Creates instance of MatFileReader and reads MAT-file from file. This method reads MAT-file without filtering.

Parameters:
file - the MAT-file
Throws:
IOException - when error occurred while processing the file.

MatFileReader

public MatFileReader(File file)
              throws IOException
Creates instance of MatFileReader and reads MAT-file from file. This method reads MAT-file without filtering.

Parameters:
file - the MAT-file
Throws:
IOException - when error occurred while processing the file.

MatFileReader

public MatFileReader(File file,
                     MatFileFilter filter)
              throws IOException
Creates instance of MatFileReader and reads MAT-file from file.

Results are filtered by MatFileFilter. Arrays that do not meet filter match condition will not be available in results.

Note: this method reads file using the memory mapped file policy, see notes to #read(File, MatFileFilter, com.jmatio.io.io.io.MatFileReader.MallocPolicy)

Parameters:
file - the MAT-file
MatFileFilter - array name filter.
Throws:
IOException - when error occurred while processing the file.

MatFileReader

public MatFileReader(File file,
                     MatFileFilter filter,
                     boolean allocate)
              throws IOException
Throws:
IOException

MatFileReader

public MatFileReader()

MatFileReader

public MatFileReader(String fileName,
                     MatFileFilter filter)
              throws IOException
Throws:
IOException
Method Detail

dispose

public void dispose()

read

public Map<String,MLArray> read(File file)
                         throws IOException
Reads the content of a MAT-file and returns the mapped content.

This method calls read(file, new MatFileFilter(), MallocPolicy.MEMORY_MAPPED_FILE).

Parameters:
file - a valid MAT-file file to be read
Returns:
the same as getContent()
Throws:
IOException - if error occurs during file processing

read

public Map<String,MLArray> read(File file,
                                int policy)
                         throws IOException
Reads the content of a MAT-file and returns the mapped content.

This method calls read(file, new MatFileFilter(), policy).

Parameters:
file - a valid MAT-file file to be read
policy - the file memory allocation policy
Returns:
the same as getContent()
Throws:
IOException - if error occurs during file processing

read

public Map<String,MLArray> read(File file,
                                MatFileFilter filter,
                                int policy)
                         throws IOException
Throws:
IOException

getMatFileHeader

public MatFileHeader getMatFileHeader()
Gets MAT-file header

Returns:
- a MatFileHeader object

getMLArray

public MLArray getMLArray(String name)
Returns the value to which the red file maps the specified array name. Returns null if the file contains no content for this name.

Parameters:
- - array name
Returns:
- the MLArray to which this file maps the specified name, or null if the file contains no content for this name.

getContent

public Map<String,MLArray> getContent()
Returns a map of MLArray objects that were inside MAT-file. MLArrays are mapped with MLArrays' names

Returns:
- a Map of MLArrays mapped with their names.


Copyright © 2006–2013 GeoSolutions. All rights reserved.