Package com.snowbound.rastermaster
Class SnowDoc
- java.lang.Object
- 
- com.snowbound.rastermaster.SnowDoc
 
- 
- All Implemented Interfaces:
- java.lang.Runnable
 
 public abstract class SnowDoc extends java.lang.Object implements java.lang.Runnable
- 
- 
Field SummaryFields Modifier and Type Field Description protected intbitDepthprotected booleancanceledjava.lang.StringdocumentIDField for storing a user-set document identifierprotected Snow.SnbdFileiofileHandleintfileSizeSource file byte countintfileTypeFile type ID as specified in Snow.Definesprotected intheightPage height represented as pixels at input resolutionprotected java.util.Localelocaleprotected intpageCountprotected booleanrenderFinishedprotected booleanrenderStartedprotected intresolutionSnow.Defines.SnowExtsnowDocTypeInternal Document Typeprotected static java.util.DatesystemDateprotected intwidthPage width represented as pixels at input resolution
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedSnowDoc()
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intbitDepth()protected abstract voidcheckPage(int pageNum)abstract voiddecompress(Snow.SnbdFileio fileHandle)Parses and lays out content on all pages of the document represented by fileHandlebyte[]extractText(int pageNum)byte[]generateImage(int imgType, int pageNum)Converts the specified page to the specified formatstatic java.util.DategetDate()intgetLastSavedImageSize()java.lang.StringgetLocale()abstract intgetNumberOfPages()java.lang.StringgetRenderState()abstract byte[]getText()booleanhasPage(int page)Check if a page exists on this Documentabstract booleanhasText()voidinterrupt()protected voidlambdaCheckPage(int pageNum, java.lang.Runnable formatPageCheckCode)booleannumberOfPagesReduced()protected abstract voidopenRaster(Snowbnd snow, int pageNum)protected abstract byte[]openVector(int pageNum)abstract doublepageHeight()abstract doublepageHeight(int page)abstract doublepageWidth()abstract doublepageWidth(int page)byte[]redactRegex(int pageNum, java.lang.String regexPattern, int redactionColor)Searches the specified page for regular expression matches and redacts any matchesbyte[]redactText(int pageNum, java.lang.String searchString, boolean isCaseSensitive, int redactionColor)Searches the specified page for text and redacts any matchesintresolution()voidsaveImageAs(byte[] dataOutput, int imgType, int pageNum)Converts the specified page to the specified format and saves it into a provided buffervoidsaveImageAs(java.lang.String fileSave, int imgType, int pageNum)Converts the specified page to the specified format and saves it in a file systemSnow.SNBD_SEARCH_RESULT[]searchRegex(int pageNum, java.lang.String regexPattern)Searches a page of this document for text that matches the provided regular expressionSnow.SNBD_SEARCH_RESULT[]searchRegexFromBuffer(byte[] buff, java.lang.String regexPattern, int[] error)Snow.SNBD_SEARCH_RESULT[]searchText(int pageNum, java.lang.String searchString, boolean isCaseSensitive)Searches a page of this document for a string of textSnow.SNBD_SEARCH_RESULT[]searchTextFromBuffer(byte[] buff, java.lang.String text, int case_sense, int[] error)voidsetBitDepth(int depth)voidsetPageHeight(int pgHeight)voidsetPageWidth(int pgWidth)voidsetResolution(int resolution)Sets pixels per inch for document layout.
 
- 
- 
- 
Field Detail- 
snowDocTypepublic Snow.Defines.SnowExt snowDocType Internal Document Type
 - 
documentIDpublic java.lang.String documentID Field for storing a user-set document identifier
 - 
fileTypepublic int fileType File type ID as specified in Snow.Defines
 - 
fileSizepublic int fileSize Source file byte count
 - 
resolutionprotected int resolution 
 - 
bitDepthprotected int bitDepth 
 - 
heightprotected int height Page height represented as pixels at input resolution
 - 
widthprotected int width Page width represented as pixels at input resolution
 - 
pageCountprotected int pageCount 
 - 
fileHandleprotected Snow.SnbdFileio fileHandle 
 - 
localeprotected java.util.Locale locale 
 - 
systemDateprotected static java.util.Date systemDate 
 - 
renderStartedprotected volatile boolean renderStarted 
 - 
renderFinishedprotected volatile boolean renderFinished 
 - 
canceledprotected volatile boolean canceled 
 
- 
 - 
Method Detail- 
generateImagepublic byte[] generateImage(int imgType, int pageNum) throws com.snowbound.rastermaster.exceptions.SnowException, java.lang.InterruptedExceptionConverts the specified page to the specified format- Parameters:
- imgType- export format as specified in Defines
- pageNum- page to export
- Returns:
- buffer containing converted page
- Throws:
- com.snowbound.rastermaster.exceptions.SnowException
- java.lang.InterruptedException
 
 - 
saveImageAspublic void saveImageAs(java.lang.String fileSave, int imgType, int pageNum) throws com.snowbound.rastermaster.exceptions.SnowException, java.lang.InterruptedExceptionConverts the specified page to the specified format and saves it in a file system- Parameters:
- fileSave- path to save location
- imgType- export format as specified in Defines
- pageNum- page to export
- Throws:
- com.snowbound.rastermaster.exceptions.SnowException
- java.lang.InterruptedException
 
 - 
saveImageAspublic void saveImageAs(byte[] dataOutput, int imgType, int pageNum) throws com.snowbound.rastermaster.exceptions.SnowException, java.lang.InterruptedExceptionConverts the specified page to the specified format and saves it into a provided buffer- Parameters:
- dataOutput- byte array to save exported page in
- imgType- export format as specified in Defines
- pageNum- page to export
- Throws:
- com.snowbound.rastermaster.exceptions.SnowException
- java.lang.InterruptedException
 
 - 
openRasterprotected abstract void openRaster(Snowbnd snow, int pageNum) throws com.snowbound.rastermaster.exceptions.SnowException, java.lang.InterruptedException - Throws:
- com.snowbound.rastermaster.exceptions.SnowException
- java.lang.InterruptedException
 
 - 
openVectorprotected abstract byte[] openVector(int pageNum) throws com.snowbound.rastermaster.exceptions.SnowException, java.lang.InterruptedException- Throws:
- com.snowbound.rastermaster.exceptions.SnowException
- java.lang.InterruptedException
 
 - 
decompresspublic abstract void decompress(Snow.SnbdFileio fileHandle) Parses and lays out content on all pages of the document represented by fileHandle- Parameters:
- fileHandle- SnbdFileio object that represents the document to decompress
 
 - 
getNumberOfPagespublic abstract int getNumberOfPages() throws java.lang.InterruptedException- Returns:
- number of pages in the document
- Throws:
- java.lang.InterruptedException
 
 - 
pageHeightpublic abstract double pageHeight() throws java.lang.InterruptedException- Returns:
- height of the first page
- Throws:
- java.lang.InterruptedException
 
 - 
pageHeightpublic abstract double pageHeight(int page) throws com.snowbound.rastermaster.exceptions.PageNotFoundException, java.lang.InterruptedException- Parameters:
- page- index of page to get the height of
- Returns:
- height of the specified page
- Throws:
- java.lang.InterruptedException
- com.snowbound.rastermaster.exceptions.PageNotFoundException
 
 - 
pageWidthpublic abstract double pageWidth() throws java.lang.InterruptedException- Returns:
- width of the first page
- Throws:
- java.lang.InterruptedException
 
 - 
pageWidthpublic abstract double pageWidth(int page) throws com.snowbound.rastermaster.exceptions.PageNotFoundException, java.lang.InterruptedException- Parameters:
- page- index of page to get the width of
- Returns:
- width of the specified page
- Throws:
- java.lang.InterruptedException
- com.snowbound.rastermaster.exceptions.PageNotFoundException
 
 - 
hasTextpublic abstract boolean hasText() - Returns:
- true if the document contains text
 
 - 
getTextpublic abstract byte[] getText() - Returns:
- String (as byte[]) representation of all text in the document
 
 - 
hasPagepublic boolean hasPage(int page) throws java.lang.InterruptedExceptionCheck if a page exists on this Document- Parameters:
- page- Zero-Indexed page number.
- Returns:
- True if page exists. False otherwise
- Throws:
- java.lang.InterruptedException- if snowdoc is on a thread, and that thread has been interrupted.
 
 - 
checkPageprotected abstract void checkPage(int pageNum) throws com.snowbound.rastermaster.exceptions.PageNotFoundException, java.lang.InterruptedException- Throws:
- com.snowbound.rastermaster.exceptions.PageNotFoundException
- java.lang.InterruptedException
 
 - 
numberOfPagesReducedpublic boolean numberOfPagesReduced() throws java.lang.InterruptedException- Throws:
- java.lang.InterruptedException
 
 - 
lambdaCheckPageprotected void lambdaCheckPage(int pageNum, java.lang.Runnable formatPageCheckCode) throws com.snowbound.rastermaster.exceptions.PageNotFoundException, java.lang.InterruptedException- Throws:
- com.snowbound.rastermaster.exceptions.PageNotFoundException
- java.lang.InterruptedException
 
 - 
searchTextpublic Snow.SNBD_SEARCH_RESULT[] searchText(int pageNum, java.lang.String searchString, boolean isCaseSensitive) throws com.snowbound.rastermaster.exceptions.SnowException, java.lang.InterruptedExceptionSearches a page of this document for a string of text- Parameters:
- pageNum- index of page to search
- searchString- string to search for
- isCaseSensitive- is the search string case sensitive?
- Returns:
- SNBD_SEARCH_RESULT[] of any matches found
- Throws:
- com.snowbound.rastermaster.exceptions.SnowException
- java.lang.InterruptedException
 
 - 
redactTextpublic byte[] redactText(int pageNum, java.lang.String searchString, boolean isCaseSensitive, int redactionColor) throws com.snowbound.rastermaster.exceptions.SnowException, java.lang.InterruptedExceptionSearches the specified page for text and redacts any matches- Parameters:
- pageNum- index of page to search
- searchString- string to search for
- isCaseSensitive- is the search string case sensitive?
- redactionColor- color to use for redaction painting
- Returns:
- byte[] representation of the page's redacted SNBD_EXTSTREAM
- Throws:
- com.snowbound.rastermaster.exceptions.SnowException
- java.lang.InterruptedException
 
 - 
searchRegexpublic Snow.SNBD_SEARCH_RESULT[] searchRegex(int pageNum, java.lang.String regexPattern) throws com.snowbound.rastermaster.exceptions.SnowException, java.lang.InterruptedExceptionSearches a page of this document for text that matches the provided regular expression- Parameters:
- pageNum- index of page to search
- regexPattern- regular expression to search for
- Returns:
- SNBD_SEARCH_RESULT[] of any matches found
- Throws:
- com.snowbound.rastermaster.exceptions.SnowException
- java.lang.InterruptedException
 
 - 
redactRegexpublic byte[] redactRegex(int pageNum, java.lang.String regexPattern, int redactionColor) throws com.snowbound.rastermaster.exceptions.SnowException, java.lang.InterruptedExceptionSearches the specified page for regular expression matches and redacts any matches- Parameters:
- pageNum- index of page to search
- regexPattern- regular expression to search for
- redactionColor- color to use for redaction painting
- Returns:
- byte[] representation of the page's redacted SNBD_EXTSTREAM
- Throws:
- com.snowbound.rastermaster.exceptions.SnowException
- java.lang.InterruptedException
 
 - 
searchTextFromBufferpublic Snow.SNBD_SEARCH_RESULT[] searchTextFromBuffer(byte[] buff, java.lang.String text, int case_sense, int[] error)- Parameters:
- buff- SNBD_EXTSTREAM buffer of the page to search
- text- String to search for
- case_sense- is the search string case sensitive?
- error- container for return values
- Returns:
- SNBD_SEARCH_RESULT[] of any matches
 
 - 
searchRegexFromBufferpublic Snow.SNBD_SEARCH_RESULT[] searchRegexFromBuffer(byte[] buff, java.lang.String regexPattern, int[] error)- Parameters:
- buff- SNBD_EXTSTREAM buffer of the page to search
- regexPattern- regular expression to search for
- error- container for return values
- Returns:
- SNBD_SEARCH_RESULT[] of any matches
 
 - 
extractTextpublic byte[] extractText(int pageNum) throws com.snowbound.rastermaster.exceptions.SnowException, java.lang.InterruptedException- Parameters:
- pageNum- page to extract
- Returns:
- SNBD_EXTSTREAM (as byte[]) representation of specified page
- Throws:
- com.snowbound.rastermaster.exceptions.SnowException
- java.lang.InterruptedException
 
 - 
getDatepublic static java.util.Date getDate() 
 - 
getLocalepublic java.lang.String getLocale() 
 - 
setPageHeightpublic void setPageHeight(int pgHeight) - Parameters:
- pgHeight- overrides internal page height during image generation
 
 - 
setPageWidthpublic void setPageWidth(int pgWidth) - Parameters:
- pgWidth- overrides internal page width during image generation
 
 - 
bitDepthpublic int bitDepth() - Returns:
- number of bits per pixel in raster output
 
 - 
setBitDepthpublic void setBitDepth(int depth) - Parameters:
- depth- sets number of bits per pixel to use during raster output
 
 - 
resolutionpublic int resolution() - Returns:
- pixels per inch for document layout
 
 - 
setResolutionpublic void setResolution(int resolution) Sets pixels per inch for document layout. Must be set before decompress() to effect output.- Parameters:
- resolution- pixels per inch to use for document layout.
 
 - 
getLastSavedImageSizepublic int getLastSavedImageSize() - Returns:
- The result of the last internally performed Snowbnd operation
 
 - 
interruptpublic void interrupt() 
 - 
getRenderStatepublic java.lang.String getRenderState() 
 
- 
 
-