public class SpenNoteDoc extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SpenNoteDoc.AuthorInfo
Author Information class.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
MODE_READ_ONLY
Read-only NoteDoc.
|
static int |
MODE_WRITABLE
Writable NoteDoc.
|
static int |
ORIENTATION_LANDSCAPE
NoteDoc in landscape orientation mode.
|
static int |
ORIENTATION_PORTRAIT
NoteDoc in portrait orientation mode.
|
| Constructor and Description |
|---|
SpenNoteDoc(Context context,
int width,
int height)
|
SpenNoteDoc(Context context,
int orientation,
int width,
int height)
|
SpenNoteDoc(Context context,
String filePath,
double rotation,
int mode)
|
SpenNoteDoc(Context context,
String filePath,
int width,
int mode)
|
SpenNoteDoc(Context context,
String filePath,
int width,
int mode,
boolean discardUnsavedData)
Creates an SpenNoteDoc instance with the specified file, read/write mode and cache handling mode.
|
SpenNoteDoc(Context context,
String filePath,
String password,
double rotation,
int mode)
|
SpenNoteDoc(Context context,
String filePath,
String password,
int width,
int mode)
|
SpenNoteDoc(Context context,
String filePath,
String password,
int width,
int mode,
boolean discardUnsavedData)
Creates an SpenNoteDoc instance with the specified file, password, read/write mode and cache handling mode.
|
| Modifier and Type | Method and Description |
|---|---|
SpenPageDoc |
appendPage()
Add a new page.
|
SpenPageDoc |
appendPage(int width,
int height)
Add a new page of the specified size.
If the size of pagedoc is too big, OutOfMemory problem may occur. |
SpenPageDoc |
appendPage(int backgroundColor,
String backgroundImagePath,
int backgourndImageMode)
Add a new page with the specified background color and background image.
|
SpenPageDoc |
appendTemplatePage(String templatePath)
Add the specified template.
|
void |
attachFile(String key,
String filePath)
Attach the specified file to the note with the specified key.
|
void |
attachTemplatePage(String templateName,
String templatePath,
int pageIndex)
Attach the specified template page with the specified template name.
|
void |
attachToFile(String filePath)
Deprecated.
As of 4.0.0, replaced by
attachToFile(String, boolean). |
void |
attachToFile(String filePath,
boolean compatibleMode)
Save all data and attach the saved data to given file with compatibleMode option.
S Pen SDK 4.0 has a big change. |
void |
backupObjectList(ArrayList<SpenObjectBase> objectList,
String filePath)
Save the specified object list to the specified file.
You can restore the saved file to the object list by calling restoreObjectList(String). |
void |
close()
Close the note document.
|
void |
close(boolean removeCache)
Close the note document.
|
SpenPageDoc |
copyPage(SpenPageDoc sourcePage,
int pageIndex)
Insert a new page at the index without save.
|
void |
detachFile(String key)
Detach the file specified by the key from the note document.
|
void |
discard()
Discard the NoteDoc instance.
|
boolean |
equals(Object o)
Compares the instance with the specified object and returns whether both is same or not.
|
int |
getAppMajorVersion()
Get the major version of the application.
|
int |
getAppMinorVersion()
Get the minor version of the application.
|
String |
getAppName()
Get application name.
|
String |
getAppPatchName()
Get the application patch name.
|
String |
getAttachedFile(String key)
Get the attached file with the specified key.
|
int |
getAttachedFileCount()
Get the number of attached files.
|
SpenNoteDoc.AuthorInfo |
getAuthorInfo()
Get the author information.
|
String |
getCoverImagePath()
Get the absolute file path of the cover image.
|
byte[] |
getExtraDataByteArray(String key)
Get the extra byte array data specified by the key.
|
int |
getExtraDataInt(String key)
Get the extra integer data specified by the key.
|
String |
getExtraDataString(String key)
Get the extra string data specified by the key.
|
String[] |
getExtraDataStringArray(String key)
Get the extra string array data specified by the key.
|
double |
getGeoTagLatitude()
Get the latitude.
|
double |
getGeoTagLongitude()
Get the longitude.
|
int |
getHeight()
Get the note height.
|
String |
getId()
Get the note ID as a UUID.
|
String |
getInternalDirectory()
Get the internal directory of the note document.
|
int |
getLastEditedPageIndex()
Get the index of the last edited page.
|
int |
getOrientation()
Get the note orientation.
|
SpenPageDoc |
getPage(int pageIndex)
Get the PageDoc instance with the specified index.
|
int |
getPageCount()
Get the number of pages in the note.
|
String |
getPageIdByIndex(int pageIndex)
Get the unique ID of the page with the specified index.
|
int |
getPageIndexById(String pageId)
Get the page index with the specified ID.
|
int |
getRotation()
Get the rotation of the note in degrees.
|
int |
getTemplatePageCount()
Get the number of template pages in the note.
|
String |
getTemplatePageName(int templateIndex)
Get the name of the template page with the specified index.
|
String |
getTemplateUri()
Get the note template URI.
|
int |
getWidth()
Get the note width.
|
boolean |
hasAttachedFile(String key)
Check if the file with the specified key is attached.
|
boolean |
hasExtraDataByteArray(String key)
Check if the extra byte array data with the specified key is present.
|
boolean |
hasExtraDataInt(String key)
Check if the extra integer data with the specified key is present.
|
boolean |
hasExtraDataString(String key)
Check if the extra string data with the specified key is present.
|
boolean |
hasExtraDataStringArray(String key)
Check if the extra string array data with the specified key is present.
|
int |
hashCode()
Gets an integer hash code for this object.
|
boolean |
hasTaggedPage()
Check if a tagged page is present.
|
SpenPageDoc |
insertPage(int pageIndex)
Insert a new page at the index.
|
SpenPageDoc |
insertPage(int pageIndex,
int width,
int height)
Insert a new page of the specified size at the specified index.
If the size of pagedoc is too big, OutOfMemory problem may occur. |
SpenPageDoc |
insertPage(int pageIndex,
int backgroundColor,
String backgroundImagePath,
int backgourndImageMode)
Insert a new page at the specified index with the specified background color and background image.
|
SpenPageDoc |
insertPages(String templateName,
int pageIndex,
int count)
Insert new pages from template page at the index.
|
SpenPageDoc |
insertTemplatePage(int pageIndex,
String templatePath)
Insert the specified template page at the specified index.
|
boolean |
isAllPageTextOnly()
Check if all the pages in the note contain only text.
|
boolean |
isChanged()
Check if the note has changed.
|
void |
movePageIndex(SpenPageDoc page,
int step)
Move the index of the specified page by the specified step.
|
void |
removeExtraDataByteArray(String key)
Remove the extra byte array data with the specified key.
|
void |
removeExtraDataInt(String key)
Remove the extra integer data.
|
void |
removeExtraDataString(String key)
Remove the extra string data.
|
void |
removeExtraDataStringArray(String key)
Remove the extra string array data.
|
void |
removePage(int pageIndex)
Remove the page with the specified index.
|
ArrayList<SpenObjectBase> |
restoreObjectList(String filePath)
Restore the object list from the specified file.
You can save the object list as a file by calling backupObjectList(ArrayList, String). |
void |
revertToTemplatePage(int pageIndex)
Reset the page with the specified index and apply the selected template.
|
void |
revertToTemplatePage(int pageIndex,
String absolutePath)
Reset the page with the specified index and apply the selected template.
|
void |
save(OutputStream stream)
Deprecated.
As of 4.0.0, replaced by
save(OutputStream, boolean). |
void |
save(OutputStream stream,
boolean compatibleMode)
Save the note data to the specified stream with compatibleMode option.
S Pen SDK 4.0 has a big change. |
void |
save(String filepath)
Deprecated.
As of 4.0.0, replaced by
save(String, boolean). |
void |
save(String filepath,
boolean compatibleMode)
Save the note data to a file with compatibleMode option.
S Pen SDK 4.0 has a big change. |
void |
setAppName(String name)
Set the specified application name.
|
void |
setAppVersion(int majorVersion,
int minorVersion,
String patchName)
Set the specified major version, minor version, and path name of the application.
|
void |
setAuthorInfo(SpenNoteDoc.AuthorInfo info)
Set the specified author information.
|
void |
setCoverImage(String filePath)
Set the image from the specified file as the note's cover image.
|
void |
setExtraDataByteArray(String key,
byte[] value)
Set the specified extra byte array data with the specified key.
|
void |
setExtraDataInt(String key,
int value)
Set the specified extra integer data with the specified key.
|
void |
setExtraDataString(String key,
String value)
Set the specified extra string data with the specified key.
|
void |
setExtraDataStringArray(String key,
String[] value)
Set the specified extra string array data with the specified key.
|
void |
setGeoTag(double latitude,
double longitude)
Set the specified geotagging data.
|
void |
setTemplateUri(String templateUri)
Set the specified template URI for the note.
|
public static final int ORIENTATION_PORTRAIT
public static final int ORIENTATION_LANDSCAPE
public static final int MODE_READ_ONLY
public static final int MODE_WRITABLE
public SpenNoteDoc(Context context, int width, int height) throws IOException
close() or discard().
If you use the subordinate classes of a NoteDoc instance after closing it by calling discard(), an exception is
thrown. If the (width, height) is too large, OutOfMemory problem may occur while using the notedoc.context - The Context for your application.width - The PageDoc width in pixels.
For a NoteDoc, this parameter should match the CanvasView width in general.height - The PageDoc height in pixels.
For a NoteDoc, this parameter should match the CanvasView height in general.IOException - If a cache directory fails to be generated.NullPointerException - If the context is null.IllegalArgumentException - Thrown if width or height less than 0.close(),
discard()public SpenNoteDoc(Context context, int orientation, int width, int height) throws IOException
close() or discard().
If you use the subordinate classes of a NoteDoc instance after closing it by calling discard(), an exception is
thrown. If the (width, height) is too large, OutOfMemory problem may occur while using the notedoc.context - The Context for your application.orientation - The orientation mode for the NoteDoc instance.
The valid values are: ORIENTATION_PORTRAIT ORIENTATION_LANDSCAPE For more
information, see Field Detail in this class reference.width - The PageDoc width in pixels.
For a NoteDoc, this parameter should match the CanvasView width in general.height - The PageDoc height in pixels.
For a NoteDoc, this parameter should match the CanvasView height in general.IOException - Thrown if the cache directory fails to be generated.IllegalArgumentException - If the orientation is invalid. Or if width or height less than 0.NullPointerException - If the context is null.close(),
discard()public SpenNoteDoc(Context context, String filePath, int width, int mode) throws IOException, SpenUnsupportedTypeException, SpenInvalidPasswordException, SpenUnsupportedVersionException
close() or discard().
If you use the subordinate classes of a NoteDoc instance after closing it by calling discard(), an exception is
thrown.context - The Context for your application.filePath - The absolute path of the files that you want to load.width - The PageDoc width in pixels.
For a NoteDoc, this parameter should match the CanvasView width in general.
If the width is changed and the user opens a SPD file, the object attributes for the page such as,
line width, and border change accordingly.
If the width is too large, OutOfMemory problem may occur while using the notedoc.mode - SpenNoteDoc mode.
If the mode is not MODE_READ_ONLY, the SpenNoteDoc mode is set to MODE_WRITABLE.
For more details, see Field Detail in this class reference.IOException - Thrown if the cache directory is not generated or the files are not found.SpenUnsupportedTypeException - Thrown if an unsupported file format is passed.SpenInvalidPasswordException - Thrown if the file requires a password.SpenUnsupportedVersionException - It not correspond to the NoteDoc file formatIllegalArgumentException - Thrown If the filePath is null. Or if width less than 32.NullPointerException - Thrown If the context is null.close(),
discard()public SpenNoteDoc(Context context, String filePath, double rotation, int mode) throws IOException, SpenUnsupportedTypeException, SpenInvalidPasswordException, SpenUnsupportedVersionException
close() or discard().
If you use the subordinate classes of a NoteDoc instance after closing it by calling discard(), an exception is
thrown. Use a double for rotation and not an integer to avoid confusion with the width parameter.context - The Context for your application.filePath - The absolute path of the files that you want to load.rotation - The rotation value for the note, page and objects.
Use a double that is divisible by 90.mode - The SpenNoteDoc mode.
If the mode is not MODE_READ_ONLY, the SpenNoteDoc mode is set to MODE_WRITABLE.
For more information, see Field Detail in this class reference.IOException - Thrown if the cache directory is not generated or the files are not found.SpenUnsupportedTypeException - Thrown if an unsupported file format is detected.SpenInvalidPasswordException - Thrown if the file requires a password.SpenUnsupportedVersionException - It not correspond to the NoteDoc file formatIllegalArgumentException - If the rotation parameter is not a double that is divisible by 90 or the filePath is null.NullPointerException - If the context is null.close(),
discard()public SpenNoteDoc(Context context, String filePath, String password, int width, int mode) throws IOException, SpenUnsupportedTypeException, SpenInvalidPasswordException, SpenUnsupportedVersionException
close() or discard().
If you use the subordinate classes of a NoteDoc instance after closing it by calling discard(), an exception is
thrown.context - The Context for your application.filePath - The absolute path of the files that you want to load.password - The password for a protected file.width - The PageDoc width in pixels.
For a NoteDoc, this parameter should match the CanvasView width in general.
If the width is changed and the user opens a SPD file, the object attributes for the page such as,
line width, and border change accordingly.
If the width is too large, OutOfMemory problem may occur while using the notedoc.mode - The mode for SpenNoteDoc.
If the mode is not MODE_READ_ONLY, the SpenNoteDoc mode is set to MODE_WRITABLE.
For more details, see Field Detail in this class reference.IOException - Thrown if the cache directory is not generated or the files are not found.SpenUnsupportedTypeException - Thrown if an unsupported file format is detected.SpenInvalidPasswordException - Thrown if the password passed is invalid.SpenUnsupportedVersionException - It not correspond to the NoteDoc file formatIllegalArgumentException - If the filePath is null. Or if width less than 32.NullPointerException - If the context is null.close(),
discard()public SpenNoteDoc(Context context, String filePath, String password, double rotation, int mode) throws IOException, SpenUnsupportedTypeException, SpenInvalidPasswordException, SpenUnsupportedVersionException
close() or discard().
If you use the subordinate classes of a NoteDoc instance after closing it by calling discard(), an exception is
thrown. Use a double for rotation and not an integer to avoid confusion with the width parameter.context - The Context for your application.filePath - The absolute path of the files that you want to load.password - The password for a protected file.rotation - The rotation for the note, page and objects.
Use a double type that is divisible by 90.mode - The SpenNoteDoc mode.
If the mode is not MODE_READ_ONLY,the SpenNoteDoc mode is set to MODE_WRITABLE.
For more details, see Field Detail in this class reference.IOException - Thrown if the cache directory is not generated or the files are not found.SpenUnsupportedTypeException - Thrown if an unsupported file format is detected.SpenInvalidPasswordException - Thrown if the password passed is invalid.SpenUnsupportedVersionException - It not correspond to the NoteDoc file formatIllegalArgumentException - Thrown if the rotation parameter is not a double that is divisible by 90 or the filePath is null.NullPointerException - Thrown if the context is null.close(),
discard()public SpenNoteDoc(Context context, String filePath, int width, int mode, boolean discardUnsavedData) throws IOException, SpenUnsupportedTypeException, SpenInvalidPasswordException, SpenUnsupportedVersionException
close() or discard().
If you use the subordinate classes of a NoteDoc instance after closing it by calling discard(), an exception is
thrown.context - The Context for your application.filePath - The absolute path of the files that you want to load.width - The PageDoc width in pixels.
For a NoteDoc, this parameter should match the CanvasView width in general.
If the width is changed and the user opens a SPD file, the object attributes for the page such as,
line width, and border change accordingly.
If the width is too large, OutOfMemory problem may occur while using the notedoc.mode - The mode for SpenNoteDoc.
If the mode is not MODE_READ_ONLY, the SpenNoteDoc mode is set to MODE_WRITABLE.
For more details, see Field Detail in this class reference.discardUnsavedData - Set to true to ignore the files in the internal cache directory and use new files, set to false to use
the files in the internal cache directory.IOException - Thrown if the cache directory is not generated or the files are not found.SpenUnsupportedTypeException - Thrown if an unsupported file format is detected.SpenUnsupportedVersionException - It not correspond to the NoteDoc file formatSpenInvalidPasswordException - If a file requires a password.IllegalArgumentException - If the filePath is null. Or if width less than 32.NullPointerException - If the context is null.close(),
discard()public SpenNoteDoc(Context context, String filePath, String password, int width, int mode, boolean discardUnsavedData) throws IOException, SpenUnsupportedTypeException, SpenInvalidPasswordException, SpenUnsupportedVersionException
close() or discard().
If you use the subordinate classes of a NoteDoc instance after closing it by calling discard(), an exception is
thrown.context - The Context for your application.filePath - The absolute path of the files that you want to load.password - The password for a protected file.width - The PageDoc width in pixels.
For a NoteDoc, this parameter should match the CanvasView width in general.
If the width is changed and the user opens a SPD file, the object attributes for the page such as,
line width, and border change accordingly.
If the width is too large, OutOfMemory problem may occur while using the notedoc.mode - The SpenNoteDoc mode.
If the mode is not MODE_READ_ONLY, the SpenNoteDoc mode is set to MODE_WRITABLE.
For more details, see Field Detail in this class reference.discardUnsavedData - Set to true to ignore the files in the internal cache directory and use new files, set to false to use
the files in the internal cache directory.IOException - If the cache directory is not generated or its files are not found.SpenUnsupportedTypeException - If an unsupported file format is detected.SpenInvalidPasswordException - If the password is invalid.SpenUnsupportedVersionException - It not correspond to the NoteDoc file formatIllegalArgumentException - If the filePath is null. Or if width less than 32.NullPointerException - If the context is null .close(),
discard()public void discard()
throws IOException
close() or discard().
If you use the subordinate classes of a NoteDoc instance after closing it by calling discard(), an exception is
thrown.
A page cannot be called when it is set (setPageDoc) on CanvasView. Initialize the page with setPageDoc(null)
before calling it.
Close controls before calling a page. You cannot call a page with controls displayed.IOException - Thrown if the cache directory or its files cannot be deleted.close()public void close()
throws IOException
IOException - Thrown if the cache directory or its files cannot be deleted.discard()public void close(boolean removeCache)
throws IOException
removeCache - Set to true to remove the cache directory of this note, set to false to not remove the cache
directory.
If you set true, it cause some latency when you open the note file(.spd) again later. Since
the all cache files for this note are removed and all cache files need to be re-created.IOException - Thrown if the cache directory or its files cannot be deleted.discard(),
close()public String getId()
public void setTemplateUri(String templateUri)
templateUri - The note template URI.getTemplateUri()public String getTemplateUri()
setTemplateUri(String)public int getWidth()
public int getHeight()
public int getRotation()
public int getOrientation()
ORIENTATION_LANDSCAPE and ORIENTATION_PORTRAIT.
For more information, see Field Detail in this class reference.public void setCoverImage(String filePath)
filePath - The absolute path of the cover image file.getCoverImagePath()public String getCoverImagePath()
setCoverImage(String)public boolean hasTaggedPage()
public boolean isAllPageTextOnly()
public void setAuthorInfo(SpenNoteDoc.AuthorInfo info)
info - The author information object.getAuthorInfo()public SpenNoteDoc.AuthorInfo getAuthorInfo()
setAuthorInfo(AuthorInfo)public void setGeoTag(double latitude,
double longitude)
latitude - The latitude between -90 to 90.longitude - The longitude between -180 to 180.IllegalArgumentException - Thrown if the latitude or longitude passed is out of range.getGeoTagLatitude(),
getGeoTagLongitude()public double getGeoTagLatitude()
setGeoTag(double, double)public double getGeoTagLongitude()
setGeoTag(double, double)public void setAppName(String name)
name - The application name.getAppName()public String getAppName()
setAppName(String)public void setAppVersion(int majorVersion,
int minorVersion,
String patchName)
majorVersion - The major version.minorVersion - The minor version.patchName - The application patch name.getAppMajorVersion(),
getAppMinorVersion(),
getAppPatchName()public int getAppMajorVersion()
setAppVersion(int, int, String)public int getAppMinorVersion()
setAppVersion(int, int, String)public String getAppPatchName()
setAppVersion(int, int, String)public void setExtraDataString(String key, String value)
key - The key for the data.value - The extra string data.IllegalArgumentException - Thrown if key is null.getExtraDataString(String)public void setExtraDataInt(String key, int value)
key - The key for the data.value - The extra integer data.IllegalArgumentException - Thrown if key is null.getExtraDataInt(String)public void setExtraDataStringArray(String key, String[] value)
key - The key for the data.value - The extra string array data.IllegalArgumentException - Thrown if key is null.getExtraDataStringArray(String)public void setExtraDataByteArray(String key, byte[] value)
key - The key for the data.value - The extra byte array data.IllegalArgumentException - Thrown if key is null.getExtraDataByteArray(String)public String getExtraDataString(String key)
key - The key for the data.setExtraDataString(String, String)public int getExtraDataInt(String key)
key - The key for the data.setExtraDataInt(String, int)public String[] getExtraDataStringArray(String key)
key - The key for the data.setExtraDataStringArray(String, String[])public byte[] getExtraDataByteArray(String key)
key - The key for the data.setExtraDataByteArray(String, byte[])public boolean hasExtraDataString(String key)
key - The key for the data.public boolean hasExtraDataInt(String key)
key - The key for the data.public boolean hasExtraDataStringArray(String key)
key - The key for the data.public boolean hasExtraDataByteArray(String key)
key - The key for the data.public void removeExtraDataString(String key)
key - The key for the data.public void removeExtraDataInt(String key)
key - The key for the data.public void removeExtraDataStringArray(String key)
key - The key for the data.public void removeExtraDataByteArray(String key)
key - The key for the data.public SpenPageDoc appendPage()
public SpenPageDoc appendPage(int backgroundColor, String backgroundImagePath, int backgourndImageMode)
backgroundColor - The background color for the page.backgroundImagePath - The absolute path of the background image file.backgourndImageMode - The background image mode for the page.
The valid value is: SpenPageDoc.BACKGROUND_IMAGE_MODE_CENTER,
SpenPageDoc.BACKGROUND_IMAGE_MODE_FIT, SpenPageDoc.BACKGROUND_IMAGE_MODE_STRETCH,
SpenPageDoc.BACKGROUND_IMAGE_MODE_TILE For more information, see Field Detail in the
SpenPageDoc class reference.IllegalArgumentException - If the backgroundImagePath or the backgourndImageMode is invalid.SpenPageDoc.BACKGROUND_IMAGE_MODE_CENTER,
SpenPageDoc.BACKGROUND_IMAGE_MODE_FIT,
SpenPageDoc.BACKGROUND_IMAGE_MODE_STRETCH,
SpenPageDoc.BACKGROUND_IMAGE_MODE_TILEpublic SpenPageDoc appendPage(int width, int height)
width - The width of the page to addheight - The height of the page to addIllegalArgumentException - If the width or height of the PageDoc is invalid.IllegalArgumentException - If width or height is negative.public SpenPageDoc insertPage(int pageIndex)
pageIndex - The page index.IndexOutOfBoundsException - Thrown if the index passed is out of range.SpenPageDoc.BACKGROUND_IMAGE_MODE_CENTERpublic SpenPageDoc insertPage(int pageIndex, int backgroundColor, String backgroundImagePath, int backgourndImageMode)
pageIndex - The page index.backgroundColor - The background color for the page.backgroundImagePath - The absolute path of the background image file.backgourndImageMode - The background image mode for the page.
The valid value is: SpenPageDoc.BACKGROUND_IMAGE_MODE_CENTER For more information, see Field
Detail in the SpenPageDoc class reference.IndexOutOfBoundsException - Thrown if the index passed is out of range.IllegalArgumentException - Thrown if the backgroundImagePath is invalid.
Thrown if the backgourndImageMode is invalid.public SpenPageDoc insertPage(int pageIndex, int width, int height)
pageIndex - The page index.width - The width of the page to insert.height - The height of the page to insert.IndexOutOfBoundsException - If the pageIndex of the NoteDoc is invalid.IllegalArgumentException - If width or height is negative.public SpenPageDoc appendTemplatePage(String templatePath) throws IOException, SpenUnsupportedTypeException
templatePath - The absolute path of the template file or the Android asset URI of the template.
Use either the absolute path of the file or the asset URI for templatePath.IOException - Thrown if the directory of the file or the asset URI does not exist.SpenUnsupportedTypeException - Thrown if an unsupported file format is detected.IllegalArgumentException - Thrown if the template orientation does not match the NoteDoc orientation.NullPointerException - Thrown if the templatePath is null.public SpenPageDoc insertTemplatePage(int pageIndex, String templatePath) throws IOException, SpenUnsupportedTypeException
pageIndex - The page index.templatePath - The absolute path of the template file or the Android asset URI of the template.
Use either the absolute path of the file or the asset URI for templatePath.IOException - Thrown if the directory of the file or the asset URI does not exist.SpenUnsupportedTypeException - Thrown if an unsupported file format is detected.IllegalArgumentException - Thrown if the template orientation does not match the NoteDoc orientation.IndexOutOfBoundsException - Thrown if the pageIndex passed is out of range.NullPointerException - Thrown if the templatePath is null.public void revertToTemplatePage(int pageIndex)
throws IOException,
SpenUnsupportedTypeException
pageIndex - The page index.IndexOutOfBoundsException - Throw if @pageIndex is out of bound.IOException - Thrown if the directory of the file or the asset URI does not exist.SpenUnsupportedTypeException - Thrown if an unsupported file format is detected.IllegalArgumentException - Thrown if the template orientation does not match the NoteDoc orientation.public void revertToTemplatePage(int pageIndex,
String absolutePath)
throws IOException,
SpenUnsupportedTypeException
pageIndex - The page index.absolutePath - The absolute path of the template.IOException - Thrown if the directory of the file or the asset URI does not exist.SpenUnsupportedTypeException - Thrown if an unsupported file format is detected.IllegalArgumentException - Thrown if the template orientation does not match the NoteDoc orientation.public void removePage(int pageIndex)
pageIndex - The page index.IndexOutOfBoundsException - Thrown if the index passed is out of range.IllegalStateException - Thrown if the notedoc is in READ_ONLY_MODE.public void movePageIndex(SpenPageDoc page, int step)
page - The page to be moved.step - The number of pages to move forward or backward.step is negative, the page is moved to the first.step is larger than index, the page is moved to the last.IllegalArgumentException - Thrown if the page passed is null.public String getPageIdByIndex(int pageIndex)
pageIndex - The page index.IndexOutOfBoundsException - Thrown if the index is out of range.public int getPageIndexById(String pageId)
pageId - The page ID.IllegalArgumentException - Thrown if the page does not exist.public SpenPageDoc getPage(int pageIndex)
pageIndex - The page index.IndexOutOfBoundsException - Thrown if the passed index is out of range.public int getPageCount()
public boolean isChanged()
public void attachFile(String key, String filePath)
key - The key for the file.filePath - The absolute path of the file.IllegalArgumentException - Thrown if the key passed is invalid or the file path is redundant or null.public void detachFile(String key)
key - The key for the file.IllegalArgumentException - Thrown if the key passed is invalid.attachFile(String,String)public int getAttachedFileCount()
public String getAttachedFile(String key)
hasAttachedFile(String).key - The key for the file.IllegalArgumentException - Thrown if the key passed is invalid.public boolean hasAttachedFile(String key)
key - The key for the file.public void save(OutputStream stream) throws IOException
save(OutputStream, boolean).save(OutputStream, boolean). save(OutputStream, boolean).stream - The OutputStream that you want to save to.
Use either ByteArrayInputStream or FileInputStream.IOException - Thrown if the data cannot be saved to the stream.IllegalArgumentException - Thrown if stream is not ByteArrayOutputStream or FileOutputStream.IllegalStateException - Thrown if the document is read only mode.public void save(String filepath) throws IOException
save(String, boolean).save(String, boolean). save(String, boolean).filepath - The absolute path of the file.IOException - Thrown if the file is not saved successfully.IllegalArgumentException - If the filepath is invalid.IllegalStateException - Thrown if the document is read only mode.public void attachToFile(String filePath) throws IOException
attachToFile(String, boolean).filePath - The absolute path of the file.IOException - Thrown if the file is not saved successfully.IllegalStateException - Thrown if the document is read only mode.public void save(OutputStream stream, boolean compatibleMode) throws IOException
stream - The OutputStream that you want to save to.
Use either ByteArrayInputStream or FileInputStream.compatibleMode - Set to true to save this note for which is compatible with S Pen SDK 3.x, set to false to save this
note for which is used for S Pen SDK 4.0 or later.IOException - Thrown if the data cannot be saved to the stream.IllegalArgumentException - Thrown if stream is not ByteArrayOutputStream or FileOutputStream.IllegalStateException - Thrown if the document is read only mode.public void save(String filepath, boolean compatibleMode) throws IOException
filepath - The absolute path of the file.compatibleMode - Set to true to save this note for which is compatible with S Pen SDK 3.x, set to false to save this
note for which is used for S Pen SDK 4.0 or later.IOException - Thrown if the file is not saved successfully.IllegalArgumentException - If the filepath is invalid.IllegalStateException - Thrown if the document is read only mode.public void attachToFile(String filePath, boolean compatibleMode) throws IOException
filePath - The absolute path of the file.compatibleMode - Set to true to save this note for which is compatible with S Pen SDK 3.x, set to false to save this
note for which is used for S Pen SDK 4.0 or later.IOException - Thrown if the file is not saved successfully.IllegalArgumentException - If the filePath is invalid.IllegalStateException - Thrown if the document is read only mode.public String getInternalDirectory()
public int getLastEditedPageIndex()
public void backupObjectList(ArrayList<SpenObjectBase> objectList, String filePath)
restoreObjectList(String).objectList - The object list that you want to save.filePath - The absolute path of the file to save.IllegalArgumentException - Thrown if the objectList is null.filePath is null.restoreObjectList(String)public ArrayList<SpenObjectBase> restoreObjectList(String filePath)
backupObjectList(ArrayList, String).filePath - The absolute path of the saved backup file.backupObjectList(ArrayList, String)public boolean equals(Object o)
public int hashCode()
public void attachTemplatePage(String templateName, String templatePath, int pageIndex) throws IOException, SpenUnsupportedTypeException, SpenInvalidPasswordException
templateName - The name of template page.templatePath - The absolute path of the template file.pageIndex - The page index at the original template.IOException - Thrown if the directory of the file does not exist.SpenUnsupportedTypeException - Thrown if an unsupported file format is detected.IllegalArgumentException - Thrown if the template orientation does not match the NoteDoc orientation. Or, if the
pageIndex or tempateName or templatePath is invalid.IndexOutOfBoundsException - Thrown if the pageIndex is equals or greater than number of pages in NoteDoc.
Or, if pageIndex is less than 0.SpenInvalidPasswordException - Thrown if the template page is locked.detachTemplatePage(String)public int getTemplatePageCount()
public String getTemplatePageName(int templateIndex)
templateIndex - Index of templateIndexOutOfBoundsException - Thrown if templateIndex is less than 0.
Or, if templateIndex is greater or equals total template pages.public SpenPageDoc insertPages(String templateName, int pageIndex, int count)
templateName - The name of template page.pageIndex - The page index.count - The number of pages to addIllegalArgumentException - Thrown if templatePage is null.
Or, if its orientation is not the same with NoteDoc orientation.IllegalStateException - Thrown if number of template page of NoteDoc is 0.IndexOutOfBoundsException - Thrown if pageIndex is greater than number of page in NoteDoc.
Or, if pageIndex is less than 0.public SpenPageDoc copyPage(SpenPageDoc sourcePage, int pageIndex)
sourcePage - The page source.pageIndex - The page index.IndexOutOfBoundsException - Thrown if the index passed is out of range.IllegalArgumentException - Thrown if sourcePage is null.
Thrown if the orientation of the source page is not the same as the orientation of the target
page and the size of source page is not the same as the size of the target page.