it.andynaz.irex.dr1000.scribble
Class ScribblesMgr

java.lang.Object
  extended by it.andynaz.irex.dr1000.scribble.ScribblesMgr

public class ScribblesMgr
extends Object

Class to manage the scribbles. Let other classes access and read the scribbles in the file metadata.db.

Version:
2013-01-04
Author:
andynaz

Field Summary
static String dbName
          Name of the SQLite database file.
 
Constructor Summary
ScribblesMgr()
           
 
Method Summary
static void format(String filePath)
          Deprecated. only for debug purpuse; will be deleted in future release
 Map<Integer,List<Integer>> getIntMap(File filePath)
          Return a map "page number → blob".
private  Connection getSQLiteConnection(File dirPath)
          Return an open connection to the SQLite database with the strokes.
private  int getUnsignedInt(byte b)
          Convert a byte in an unsigned int.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbName

public static String dbName
Name of the SQLite database file.

Constructor Detail

ScribblesMgr

public ScribblesMgr()
Method Detail

getIntMap

public Map<Integer,List<Integer>> getIntMap(File filePath)
                                     throws ClassNotFoundException,
                                            SQLException
Return a map "page number → blob". Each blob is taken from the 'metadata.db' file and is represented as a list of Integers.

Parameters:
filePath - path to the PDF file
Returns:
a map "page number → blob"
Throws:
ClassNotFoundException - if the class for the JDBC driver is not found
SQLException - if SQL errors occur

getSQLiteConnection

private Connection getSQLiteConnection(File dirPath)
                                throws ClassNotFoundException,
                                       SQLException
Return an open connection to the SQLite database with the strokes. The SQLite database is stored in a file 'metadata.db' in the same folder of the PDF file.

Parameters:
dirPath - path of the folder which contains the PDF and the metadata.db file
Returns:
a connection to the scribbles database
Throws:
ClassNotFoundException - if the class for the JDBC driver is not found
SQLException - if SQL errors occur

getUnsignedInt

private int getUnsignedInt(byte b)
Convert a byte in an unsigned int. The convertion is based on the bits of the byte (they are considered as a base-2 number).

Parameters:
b - a byte
Returns:
the int corresponding to the bits in the byte as a base-2 number

format

public static void format(String filePath)
                   throws Exception
Deprecated. only for debug purpuse; will be deleted in future release

Create a file with all the scribbles in a text format.

Parameters:
filePath - path to the PDF file
Throws:
Exception - in caso of exception


(c) 2013 andynaz - http://andynaz.altervista.org