Elexis API documentation
Version 2.1.6 as of December 11 2011

com.healthmarketscience.jackcess.scsu
Class Compress

java.lang.Object
  extended by com.healthmarketscience.jackcess.scsu.SCSU
      extended by com.healthmarketscience.jackcess.scsu.Compress

public class Compress
extends SCSU

This class implements a simple compression algorithm


Constructor Summary
Compress()
           
 
Method Summary
 int bytesWritten()
          returns the number of bytes written
 int charsRead()
          returns the number of bytes written
 byte[] compress(java.lang.String inStr)
           
static boolean isAsciiCrLfOrTab(int ch)
          returns true if the character is ASCII, but not a control other than CR, LF and TAB
 int outputSingleByteRun(char[] in, byte[] out)
          output a run of characters in single byte mode In single byte mode pass through characters in the ASCII range, but quote characters overlapping with compression command codes.
 char outputUnicodeRun(char[] in, byte[] out)
          output a run of characters in Unicode mode A run of Unicode mode consists of characters which are all in the range of non-compressible characters or isolated occurrence of any other characters.
 void reset()
          reset is only needed to bail out after an exception and restart with new input
 int simpleCompress(char[] in, int iStartIn, byte[] out, int iStartOut)
          compress a Unicode character array with some simplifying assumptions
 
Methods inherited from class com.healthmarketscience.jackcess.scsu.SCSU
isCompressible
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Compress

public Compress()
Method Detail

isAsciiCrLfOrTab

public static boolean isAsciiCrLfOrTab(int ch)
returns true if the character is ASCII, but not a control other than CR, LF and TAB


outputSingleByteRun

public int outputSingleByteRun(char[] in,
                               byte[] out)
                        throws EndOfOutputException,
                               EndOfInputException,
                               IllegalInputException
output a run of characters in single byte mode In single byte mode pass through characters in the ASCII range, but quote characters overlapping with compression command codes. Runs of characters fitting the current window are output as runs of bytes in the range 0x80-0xFF. Checks for and validates Surrogate Pairs. Uses and updates the current input and output cursors store in the instance variables iIn and iOut.

Parameters:
in - - input character array
out - - output byte array
Returns:
the next chaacter to be processed. This may be an extended character.
Throws:
EndOfOutputException
EndOfInputException
IllegalInputException

outputUnicodeRun

public char outputUnicodeRun(char[] in,
                             byte[] out)
                      throws EndOfOutputException
output a run of characters in Unicode mode A run of Unicode mode consists of characters which are all in the range of non-compressible characters or isolated occurrence of any other characters. Characters in the range 0xE00-0xF2FF must be quoted to avoid overlap with the Unicode mode compression command codes. Uses and updates the current input and output cursors store in the instance variables iIn and iOut. NOTE: Characters from surrogate pairs are passed through and unlike single byte mode no checks are made for unpaired surrogate characters.

Parameters:
in - - input character array
out - - output byte array
Returns:
the next input character to be processed
Throws:
EndOfOutputException

simpleCompress

public int simpleCompress(char[] in,
                          int iStartIn,
                          byte[] out,
                          int iStartOut)
                   throws IllegalInputException,
                          EndOfInputException,
                          EndOfOutputException
compress a Unicode character array with some simplifying assumptions

Throws:
IllegalInputException
EndOfInputException
EndOfOutputException

compress

public byte[] compress(java.lang.String inStr)
                throws IllegalInputException,
                       EndOfInputException
Throws:
IllegalInputException
EndOfInputException

reset

public void reset()
reset is only needed to bail out after an exception and restart with new input

Overrides:
reset in class SCSU

bytesWritten

public int bytesWritten()
returns the number of bytes written


charsRead

public int charsRead()
returns the number of bytes written


Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis