public class SpenNoteFile extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ORIENTATION_LANDSCAPE
Landscape orientation
If a SpenNoteDoc has this type, the SpenNoteDoc is landscape. |
static int |
ORIENTATION_PORTRAIT
Portrait orientation.
If a SpenNoteDoc has this type, the SpenNoteDoc is portrait. |
| Modifier and Type | Method and Description |
|---|---|
static void |
copy(String destFilePath,
String srcFilePath)
Copy the file from the specified source path to the specified destination path.
The SpenNoteDoc in the copied file gets a new UUID. |
static String |
getAppName(String filePath)
Get the application name of the specified file.
|
static void |
getAppVersion(String filePath,
Integer major,
Integer minor,
StringBuffer patchName)
Get the application version of the specified file.
|
static String |
getCoverImagePath(Context context,
String filePath)
Get the cover image from the specified file.
NOTICE: Call
releaseCoverImagePath(String) when don't access the image anymore. |
static int |
getFormatVersion(String filePath)
Get the version of file format of the specified file.
|
static int |
getOrientation(String filePath)
Get the orientation of the specified file.
|
static void |
getSize(String filePath,
Integer width,
Integer height)
Get the width and height of the specified file.
|
static boolean |
hasUnsavedData(Context context,
String filePath,
Long lastEditedTime)
Check if the internal cache directory has unsaved information on the note.
|
static boolean |
isFavorite(String filePath)
Check if the specified file is set as a favorite.
|
static boolean |
isLocked(String filePath)
Check if the file is locked(encrypted).
But, you don't verify whether the file is locked by normal password or signature. |
static boolean |
isValid(String filePath)
Check if the specified file is a valid SPD file.
|
static void |
lock(Context context,
String filePath,
String password)
Lock(encrypt) the specified file.
|
static void |
releaseCoverImagePath(String coverImagePath)
Delete cover image cache folder from cover image path.
|
static void |
removeCache(Context context,
String filePath)
Remove all cache directories which are related with given file.
CAUTION!! You should call this method very carefully. If there is a NoteDoc instance which is loaded from the file, the NoteDoc instance will not work properly. |
static void |
removeNote(String filePath)
Remove the note data in the specified file.
|
static void |
setCoverImage(Context context,
String filePath,
String password,
String imageFilePath)
Set the specified cover image for the specified file.
|
static void |
setFavorite(String filePath,
boolean flag)
Set the specified file as a favorite.
|
static void |
unlock(Context context,
String filePath,
String password)
Unlock(decrypt) the specified file.
|
public static final int ORIENTATION_PORTRAIT
SpenNoteDoc.SpenNoteDoc(Context, int, int, int),
SpenNoteDoc.getOrientation(),
Constant Field Valuespublic static final int ORIENTATION_LANDSCAPE
SpenNoteDoc.SpenNoteDoc(Context, int, int, int),
SpenNoteDoc.getOrientation(),
Constant Field Valuespublic static void lock(Context context, String filePath, String password) throws IOException, SpenUnsupportedTypeException
context - The Context for your application.filePath - The absolute path of the file.password - The password for the file.IOException - Thrown if the file is not found, or if a temporary directory cannot be created.SpenUnsupportedTypeException - Thrown if the file is not in SPD file format.NullPointerException - Thrown if context is null.IllegalArgumentException - Thrown if filePath is null.unlock(Context, String, String),
isLocked(String)public static void unlock(Context context, String filePath, String password) throws IOException, SpenInvalidPasswordException, SpenUnsupportedTypeException
context - The Context for your application.filePath - The absolute path of the file.password - The password for the file.IOException - Thrown if the cache directory cannot be created or the file is not found.SpenInvalidPasswordException - Thrown if the password is wrong.SpenUnsupportedTypeException - Thrown if the file is not in SPD file format.NullPointerException - Thrown if context is null.IllegalArgumentException - Thrown if filePath or password is null.lock(Context, String, String),
isLocked(String)public static boolean isLocked(String filePath)
SpenNoteFileSignature.isLocked(String).filePath - The absolute path of the file.true, if the file is locked.false, if the file is not locked.lock(Context, String, String),
unlock(Context, String, String),
SpenNoteFileSignature.isLocked(String)public static void copy(String destFilePath, String srcFilePath) throws IOException, SpenUnsupportedTypeException
destFilePath - The destination file path.srcFilePath - The source file path.IllegalArgumentException - Thrown if destFilePath is null.
Thrown if srcFilePath is null.IOException - Thrown if the file cannot be copied or if the file is not found.SpenUnsupportedTypeException - Thrown if the file is not in SPD file formatpublic static void setFavorite(String filePath, boolean flag) throws IOException, SpenUnsupportedTypeException
filePath - The absolute path of the file.flag - Set to true to set the file as a favorite, set to false to not set the file as a
favorite.IOException - Thrown if the file is not found.SpenUnsupportedTypeException - Thrown if the file is not in SPD file format.IllegalArgumentException - Thrown if the filePath is null.isFavorite(String)public static boolean isFavorite(String filePath)
filePath - The absolute path of the file.true, if the file is set as a favorite.false, if the file is not set as a favorite.setFavorite(String, boolean)public static boolean isValid(String filePath)
filePath - The absolute path of the file.true, if the specified file is a valid SPD file.false, if the specified file is not
a valid SPD file.public static void setCoverImage(Context context, String filePath, String password, String imageFilePath) throws IOException, SpenUnsupportedTypeException
context - The Context for your application.filePath - The absolute file path.password - The password for the file. If the file is not locked, please enter null.imageFilePath - The absolute path of the cover image.IOException - Thrown if the cache directory cannot be created or if the file is not found.SpenUnsupportedTypeException - Thrown if the file is not in SPD file format.NullPointerException - Thrown if the context is null.IllegalArgumentException - Thrown if filePath or imageFilePath is null.RuntimeException - Thrown if password is null (for locked files)
or is invalid (for unlocked file).getCoverImagePath(Context, String)public static String getCoverImagePath(Context context, String filePath)
releaseCoverImagePath(String) when don't access the image anymore.context - The Context for your application.filePath - The absolute path of the file.null, if the file has no cover image or if there is any
error.NullPointerException - Thrown if context or filePath is invalid.setCoverImage(Context, String, String, String)public static void releaseCoverImagePath(String coverImagePath)
getCoverImagePath(Context, String)coverImagePath - IllegalArgumentException - Throw if coverImagePath is null.getCoverImagePath(Context, String)public static int getOrientation(String filePath)
filePath - The absolute path of the file.ORIENTATION_LANDSCAPE or ORIENTATION_PORTRAITORIENTATION_LANDSCAPE,
ORIENTATION_PORTRAITpublic static boolean hasUnsavedData(Context context, String filePath, Long lastEditedTime)
context - The Context for your application.filePath - The absolute path of the file.lastEditedTime - The time when the note was last edited. (output parameter)true, if there is unsaved information on the note in the internal cache directory.false, if there is no unsaved information on the note in the internal cache directory.public static void removeNote(String filePath) throws IOException, SpenUnsupportedTypeException
filePath - The absolute path of the file.IOException - Thrown if the cache directory cannot be created or if the file is not found.SpenUnsupportedTypeException - Thrown if the file is not in SPD file format.IllegalArgumentException - Thrown if the filePath is null.SpenNoteDoc.attachToFile(String)public static void getSize(String filePath, Integer width, Integer height)
filePath - The absolute path of the file.width - The width of the note in pixels. (output parameter)height - The height of the note in pixels. (output parameter)IllegalArgumentException - Thrown if the filePath is null.public static String getAppName(String filePath)
filePath - The absolute path of the file.SpenNoteDoc.setAppName(String) sets the application name
to "null"IllegalArgumentException - Thrown if the filePath is null.SpenNoteDoc.setAppName(String)public static void getAppVersion(String filePath, Integer major, Integer minor, StringBuffer patchName)
filePath - The absolute path of the file.major - The major version of the note. (output parameter)minor - The minor version of the note. (output parameter)patchName - The patch name of the note. (output parameter)SpenNoteDoc.setAppVersion(int, int, String) sets the
patch name to "null".IllegalArgumentException - If the filePath is null.SpenNoteDoc.setAppVersion(int, int, String)public static int getFormatVersion(String filePath)
filePath - The absolute path of the file.0, if the filePath is invalid or if the file is not a
valid SPD file.public static void removeCache(Context context, String filePath)
context - The Context for your application.filePath - The absolute path of the file.