zinger.bsheet
Class FlatFilePersistence

java.lang.Object
  extended by zinger.bsheet.AbstractPersistence
      extended by zinger.bsheet.StandardMapPersistence
          extended by zinger.bsheet.StreamMapPersistence
              extended by zinger.bsheet.FlatFilePersistence
All Implemented Interfaces:
Persistence

public class FlatFilePersistence
extends StreamMapPersistence


Field Summary
protected  int[] colDelimChars
           
protected  int[] commentChars
           
protected  boolean eolIsSignificant
           
static FlatFilePersistence INSTANCE
           
protected  int[] ordinaryChars
           
protected  int[] quoteChars
           
protected  int[] rowDelimChars
           
protected  boolean slashSlashComments
           
protected  boolean slashStarComments
           
 
Fields inherited from class zinger.bsheet.StandardMapPersistence
APPEARANCE_MAP_KEY, COLUMN_IDENTIFIERS_KEY, COLUMNS_KEY, DATA_VECTOR_KEY, DATA_VECTOR_LENGTH_KEY, FORMATS_KEY, ROW_HEIGHTS_KEY, VERSION_KEY
 
Fields inherited from class zinger.bsheet.AbstractPersistence
extensions, fileFilter
 
Constructor Summary
protected FlatFilePersistence()
           
protected FlatFilePersistence(javax.swing.filechooser.FileFilter fileFilter, java.lang.String[] extensions)
           
 
Method Summary
protected  java.io.StreamTokenizer createColumnTokenizer(java.io.Reader r)
           
protected  java.io.StreamTokenizer createRowTokenizer(java.io.Reader r)
           
protected  java.io.StreamTokenizer createTokenizer(java.io.Reader r, int[] quoteChars, int[] whitespaceChars)
           
protected  boolean doPromptForParseSettings(java.awt.Component parent)
           
 java.lang.CharSequence getColDelimChars()
           
 java.lang.CharSequence getCommentChars()
           
 java.lang.CharSequence getOrdinaryChars()
           
 java.lang.CharSequence getQuoteChars()
           
 java.lang.CharSequence getRowDelimChars()
           
 boolean getSlashSlashComments()
           
 boolean getSlashStarComments()
           
 boolean isEOLSignificant()
           
protected  boolean isQuote(int ttype)
           
protected  java.util.Map load(java.io.InputStream is)
           
 boolean load(javax.swing.JTable table, java.io.File file)
          Prompts for parsing settings before calling superclass' implementation.
 int[] readEscapedChars(java.lang.CharSequence escapedChars)
           
protected  java.util.Map save(javax.swing.JTable table)
           
 boolean save(javax.swing.JTable table, java.io.File file)
          Prompts for parsing settings before calling superclass' implementation.
protected  void save(java.util.Map map, java.io.OutputStream os)
           
 void setColDelimChars(java.lang.CharSequence colDelimChars)
           
 void setCommentChars(java.lang.CharSequence commentChars)
           
 void setEOLSignificant(boolean eolSignificant)
           
 void setOrdinaryChars(java.lang.CharSequence ordinaryChars)
           
 void setQuoteChars(java.lang.CharSequence quoteChars)
           
 void setRowDelimChars(java.lang.CharSequence rowDelimChars)
           
 void setSlashSlashComments(boolean slashSlashComments)
           
 void setSlashStarComments(boolean slashStarComments)
           
 java.lang.CharSequence writeEscapedChars(int[] chars)
           
 
Methods inherited from class zinger.bsheet.StreamMapPersistence
load, save
 
Methods inherited from class zinger.bsheet.StandardMapPersistence
decompressDataVector, evalValues, getColumns, getCompressedDataVector, isLoadCapable, load, setColumns
 
Methods inherited from class zinger.bsheet.AbstractPersistence
autocorrectFile, getFileFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final FlatFilePersistence INSTANCE

commentChars

protected int[] commentChars

quoteChars

protected int[] quoteChars

eolIsSignificant

protected boolean eolIsSignificant

ordinaryChars

protected int[] ordinaryChars

slashSlashComments

protected boolean slashSlashComments

slashStarComments

protected boolean slashStarComments

rowDelimChars

protected int[] rowDelimChars

colDelimChars

protected int[] colDelimChars
Constructor Detail

FlatFilePersistence

protected FlatFilePersistence()

FlatFilePersistence

protected FlatFilePersistence(javax.swing.filechooser.FileFilter fileFilter,
                              java.lang.String[] extensions)
Method Detail

getCommentChars

public java.lang.CharSequence getCommentChars()
Since:
1.0.5

setCommentChars

public void setCommentChars(java.lang.CharSequence commentChars)
Since:
1.0.5

getQuoteChars

public java.lang.CharSequence getQuoteChars()
Since:
1.0.5

setQuoteChars

public void setQuoteChars(java.lang.CharSequence quoteChars)
Since:
1.0.5

isEOLSignificant

public boolean isEOLSignificant()
Since:
1.0.5

setEOLSignificant

public void setEOLSignificant(boolean eolSignificant)
Since:
1.0.5

getOrdinaryChars

public java.lang.CharSequence getOrdinaryChars()
Since:
1.0.5

setOrdinaryChars

public void setOrdinaryChars(java.lang.CharSequence ordinaryChars)
Since:
1.0.5

getSlashSlashComments

public boolean getSlashSlashComments()
Since:
1.0.5

setSlashSlashComments

public void setSlashSlashComments(boolean slashSlashComments)
Since:
1.0.5

getSlashStarComments

public boolean getSlashStarComments()
Since:
1.0.5

setSlashStarComments

public void setSlashStarComments(boolean slashStarComments)
Since:
1.0.5

getRowDelimChars

public java.lang.CharSequence getRowDelimChars()
Since:
1.0.5

setRowDelimChars

public void setRowDelimChars(java.lang.CharSequence rowDelimChars)
Since:
1.0.5

getColDelimChars

public java.lang.CharSequence getColDelimChars()
Since:
1.0.5

setColDelimChars

public void setColDelimChars(java.lang.CharSequence colDelimChars)
Since:
1.0.5

writeEscapedChars

public java.lang.CharSequence writeEscapedChars(int[] chars)
Since:
1.0.5

readEscapedChars

public int[] readEscapedChars(java.lang.CharSequence escapedChars)

doPromptForParseSettings

protected boolean doPromptForParseSettings(java.awt.Component parent)

createTokenizer

protected java.io.StreamTokenizer createTokenizer(java.io.Reader r,
                                                  int[] quoteChars,
                                                  int[] whitespaceChars)

createRowTokenizer

protected java.io.StreamTokenizer createRowTokenizer(java.io.Reader r)

createColumnTokenizer

protected java.io.StreamTokenizer createColumnTokenizer(java.io.Reader r)

isQuote

protected boolean isQuote(int ttype)
Since:
0.9.7

save

protected void save(java.util.Map map,
                    java.io.OutputStream os)
             throws java.io.IOException
Specified by:
save in class StreamMapPersistence
Throws:
java.io.IOException

load

protected java.util.Map load(java.io.InputStream is)
                      throws java.io.IOException
Specified by:
load in class StreamMapPersistence
Throws:
java.io.IOException

save

public boolean save(javax.swing.JTable table,
                    java.io.File file)
             throws java.io.IOException
Prompts for parsing settings before calling superclass' implementation. If the parse settings are canceled by the user returns false

Specified by:
save in interface Persistence
Overrides:
save in class StandardMapPersistence
Returns:
true if the document was persisted successfully
Throws:
java.io.IOException - if an IO problem occurred during persisting the document

load

public boolean load(javax.swing.JTable table,
                    java.io.File file)
             throws java.io.IOException,
                    java.lang.UnsupportedOperationException
Prompts for parsing settings before calling superclass' implementation. If the parse settings are canceled by the user returns false

Specified by:
load in interface Persistence
Overrides:
load in class StandardMapPersistence
Returns:
true if the document was loaded successfully
Throws:
java.io.IOException - if an IO problem occurred during loading the document
java.lang.UnsupportedOperationException - if the implementation is not capable of loading documents as per isLoadCapable() method
See Also:
Persistence.isLoadCapable()

save

protected java.util.Map save(javax.swing.JTable table)
Overrides:
save in class StandardMapPersistence