diff options
Diffstat (limited to 'src')
23 files changed, 269 insertions, 310 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/Cursor.java b/src/main/java/com/healthmarketscience/jackcess/Cursor.java index 7260b79..8503623 100644 --- a/src/main/java/com/healthmarketscience/jackcess/Cursor.java +++ b/src/main/java/com/healthmarketscience/jackcess/Cursor.java @@ -31,7 +31,7 @@ import com.healthmarketscience.jackcess.util.IterableBuilder; * of table modification during traversal (although depending on how the table * is traversed, row updates may or may not be seen). Multiple cursors may * traverse the same table simultaneously. - * <p/> + * <br> * Basic cursors will generally iterate table data in the order it appears in * the database and searches will require scanning the entire table. * Additional features are available when utilizing an {@link Index} backed @@ -135,7 +135,7 @@ public interface Cursor extends Iterable<Row> * Iterator which will iterate through all the rows of this table. Use of * the Iterator follows the same restrictions as a call to * {@link #getNextRow}. - * <p/> + * <br> * For more flexible iteration see {@link #newIterable}. * @throws RuntimeIOException if an IOException is thrown by one of the * operations, the actual exception will be contained within @@ -151,7 +151,7 @@ public interface Cursor extends Iterable<Row> /** * Delete the current row. - * <p/> + * <br> * Note, re-deleting an already deleted row is allowed (it does nothing). * @throws IllegalStateException if the current row is not valid (at * beginning or end of table) @@ -178,7 +178,7 @@ public interface Cursor extends Iterable<Row> /** * Moves to the next row in the table and returns it. - * @return The next row in this table (Column name -> Column value), or + * @return The next row in this table (Column name -> Column value), or * {@code null} if no next row is found */ public Row getNextRow() throws IOException; @@ -186,7 +186,7 @@ public interface Cursor extends Iterable<Row> /** * Moves to the next row in the table and returns it. * @param columnNames Only column names in this collection will be returned - * @return The next row in this table (Column name -> Column value), or + * @return The next row in this table (Column name -> Column value), or * {@code null} if no next row is found */ public Row getNextRow(Collection<String> columnNames) @@ -194,7 +194,7 @@ public interface Cursor extends Iterable<Row> /** * Moves to the previous row in the table and returns it. - * @return The previous row in this table (Column name -> Column value), or + * @return The previous row in this table (Column name -> Column value), or * {@code null} if no previous row is found */ public Row getPreviousRow() throws IOException; @@ -202,7 +202,7 @@ public interface Cursor extends Iterable<Row> /** * Moves to the previous row in the table and returns it. * @param columnNames Only column names in this collection will be returned - * @return The previous row in this table (Column name -> Column value), or + * @return The previous row in this table (Column name -> Column value), or * {@code null} if no previous row is found */ public Row getPreviousRow(Collection<String> columnNames) @@ -325,12 +325,12 @@ public interface Cursor extends Iterable<Row> public int movePreviousRows(int numRows) throws IOException; /** - * Returns the current row in this cursor (Column name -> Column value). + * Returns the current row in this cursor (Column name -> Column value). */ public Row getCurrentRow() throws IOException; /** - * Returns the current row in this cursor (Column name -> Column value). + * Returns the current row in this cursor (Column name -> Column value). * @param columnNames Only column names in this collection will be returned */ public Row getCurrentRow(Collection<String> columnNames) diff --git a/src/main/java/com/healthmarketscience/jackcess/CursorBuilder.java b/src/main/java/com/healthmarketscience/jackcess/CursorBuilder.java index 831c78f..3ae058b 100644 --- a/src/main/java/com/healthmarketscience/jackcess/CursorBuilder.java +++ b/src/main/java/com/healthmarketscience/jackcess/CursorBuilder.java @@ -34,14 +34,14 @@ import com.healthmarketscience.jackcess.util.ColumnMatcher; * Builder style class for constructing a {@link Cursor}. By default, a * cursor is created at the beginning of the table, and any start/end rows are * inclusive. - * <p/> + * <br> * Simple example traversal: * <pre> * for(Row row : table.newCursor().toCursor()) { * // ... process each row ... * } * </pre> - * <p/> + * <br> * Simple example search: * <pre> * Row row = CursorBuilder.findRow(table, Collections.singletonMap(col, "foo")); diff --git a/src/main/java/com/healthmarketscience/jackcess/Database.java b/src/main/java/com/healthmarketscience/jackcess/Database.java index d853fe8..2006dcf 100644 --- a/src/main/java/com/healthmarketscience/jackcess/Database.java +++ b/src/main/java/com/healthmarketscience/jackcess/Database.java @@ -44,11 +44,11 @@ import com.healthmarketscience.jackcess.util.TableIterableBuilder; * Database has been opened, you can interact with the data via the relevant * {@link Table}. When a Database instance is no longer useful, it should * <b>always</b> be closed ({@link #close}) to avoid corruption. - * <p/> + * <br> * Database instances (and all the related objects) are <i>not</i> * thread-safe. However, separate Database instances (and their respective * objects) can be used by separate threads without a problem. - * <p/> + * <br> * Database instances do not implement any "transactional" support, and * therefore concurrent editing of the same database file by multiple Database * instances (or with outside programs such as MS Access) <i>will generally @@ -240,7 +240,7 @@ public interface Database extends Iterable<Table>, Closeable, Flushable /** * Finds all the relationships in the database in <i>non-system</i> tables. - * </p> + * <br> * Warning, this may load <i>all</i> the Tables (metadata, not data) in the * database which could cause memory issues. * @usage _intermediate_method_ @@ -250,7 +250,7 @@ public interface Database extends Iterable<Table>, Closeable, Flushable /** * Finds <i>all</i> the relationships in the database, <i>including system * tables</i>. - * </p> + * <br> * Warning, this may load <i>all</i> the Tables (metadata, not data) in the * database which could cause memory issues. * @usage _intermediate_method_ diff --git a/src/main/java/com/healthmarketscience/jackcess/DatabaseBuilder.java b/src/main/java/com/healthmarketscience/jackcess/DatabaseBuilder.java index c5e0252..5aebdd4 100644 --- a/src/main/java/com/healthmarketscience/jackcess/DatabaseBuilder.java +++ b/src/main/java/com/healthmarketscience/jackcess/DatabaseBuilder.java @@ -35,12 +35,12 @@ import com.healthmarketscience.jackcess.util.MemFileChannel; /** * Builder style class for opening/creating a {@link Database}. - * <p/> + * <br> * Simple example usage: * <pre> * Database db = DatabaseBuilder.open(new File("test.mdb")); * </pre> - * <p/> + * <br> * Advanced example usage: * <pre> * Database db = new DatabaseBuilder(new File("test.mdb")) diff --git a/src/main/java/com/healthmarketscience/jackcess/IndexCursor.java b/src/main/java/com/healthmarketscience/jackcess/IndexCursor.java index 1e4aa34..a48a2ce 100644 --- a/src/main/java/com/healthmarketscience/jackcess/IndexCursor.java +++ b/src/main/java/com/healthmarketscience/jackcess/IndexCursor.java @@ -41,9 +41,9 @@ public interface IndexCursor extends Cursor * @param entryValues the column values for the index's columns. * @return the matching row or {@code null} if a match could not be found. */ - public Row findRowByEntry(Object... entryValues) + public Row findRowByEntry(Object... entryValues) throws IOException; - + /** * Moves to the first row (as defined by the cursor) where the index entries * match the given values. If a match is not found (or an exception is @@ -56,32 +56,32 @@ public interface IndexCursor extends Cursor * @return {@code true} if a valid row was found with the given values, * {@code false} if no row was found */ - public boolean findFirstRowByEntry(Object... entryValues) + public boolean findFirstRowByEntry(Object... entryValues) throws IOException; /** * Moves to the first row (as defined by the cursor) where the index entries - * are >= the given values. If a an exception is thrown, the cursor is + * are >= the given values. If a an exception is thrown, the cursor is * restored to its previous state. * * @param entryValues the column values for the index's columns. */ - public void findClosestRowByEntry(Object... entryValues) + public void findClosestRowByEntry(Object... entryValues) throws IOException; /** * Returns {@code true} if the current row matches the given index entries. - * + * * @param entryValues the column values for the index's columns. */ - public boolean currentRowMatchesEntry(Object... entryValues) + public boolean currentRowMatchesEntry(Object... entryValues) throws IOException; /** * Convenience method for constructing a new EntryIterableBuilder for this * cursor. An EntryIterableBuilder provides a variety of options for more * flexible iteration based on a specific index entry. - * + * * @param entryValues the column values for the index's columns. */ public EntryIterableBuilder newEntryIterable(Object... entryValues); diff --git a/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java b/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java index 516a098..c8c8703 100644 --- a/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java +++ b/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java @@ -80,7 +80,7 @@ public interface PropertyMap extends Iterable<PropertyMap.Property> * determine the type of the property based on the name and value (the * property names listed above have their types builtin, otherwise the type * of the value is used). - * <p/> + * <br> * Note, this change will not be persisted until the {@link #save} method * has been called. * @@ -92,7 +92,7 @@ public interface PropertyMap extends Iterable<PropertyMap.Property> /** * Creates a new (or updates an existing) property in the map. - * <p/> + * <br> * Note, this change will not be persisted until the {@link #save} method * has been called. * @@ -102,7 +102,7 @@ public interface PropertyMap extends Iterable<PropertyMap.Property> /** * Creates a new (or updates an existing) property in the map. - * <p/> + * <br> * Note, this change will not be persisted until the {@link #save} method * has been called. * @@ -151,7 +151,7 @@ public interface PropertyMap extends Iterable<PropertyMap.Property> /** * Sets the new value for this property. - * <p/> + * <br> * Note, this change will not be persisted until the {@link * PropertyMap#save} method has been called. */ diff --git a/src/main/java/com/healthmarketscience/jackcess/RelationshipBuilder.java b/src/main/java/com/healthmarketscience/jackcess/RelationshipBuilder.java index 3ca3e85..d183de0 100644 --- a/src/main/java/com/healthmarketscience/jackcess/RelationshipBuilder.java +++ b/src/main/java/com/healthmarketscience/jackcess/RelationshipBuilder.java @@ -32,7 +32,7 @@ import com.healthmarketscience.jackcess.impl.RelationshipImpl; * if integrity enforcement is enabled, there must already be a unique index * on the "from" Table for the relevant columns (same requirement as MS * Access). - * <p/> + * <br> * Example: * <pre> * Relationship rel = new RelationshipBuilder("FromTable", "ToTable") diff --git a/src/main/java/com/healthmarketscience/jackcess/Row.java b/src/main/java/com/healthmarketscience/jackcess/Row.java index a599c20..4e43541 100644 --- a/src/main/java/com/healthmarketscience/jackcess/Row.java +++ b/src/main/java/com/healthmarketscience/jackcess/Row.java @@ -26,7 +26,7 @@ import com.healthmarketscience.jackcess.util.OleBlob; /** - * A row of data as column name->value pairs. Values are strongly typed, and + * A row of data as column name->value pairs. Values are strongly typed, and * column names are case sensitive. * * @author James Ahlborn @@ -35,7 +35,7 @@ import com.healthmarketscience.jackcess.util.OleBlob; public interface Row extends Map<String,Object> { /** - * @return the id of this row + * @return the id of this row */ public RowId getId(); @@ -108,7 +108,7 @@ public interface Row extends Map<String,Object> /** * Convenience method which gets the value for the row with the given name, * converting it to an {@link OleBlob} (DataTypes OLE). - * </p> + * <br> * Note, <i>the OleBlob should be closed after use</i>. */ public OleBlob getBlob(String name) throws IOException; diff --git a/src/main/java/com/healthmarketscience/jackcess/Table.java b/src/main/java/com/healthmarketscience/jackcess/Table.java index bbb6885..496f2ea 100644 --- a/src/main/java/com/healthmarketscience/jackcess/Table.java +++ b/src/main/java/com/healthmarketscience/jackcess/Table.java @@ -33,7 +33,7 @@ import com.healthmarketscience.jackcess.util.ErrorHandler; * {@link TableBuilder}. The {@link com.healthmarketscience.jackcess.util.Joiner} utility can be used to traverse * table relationships (e.g. find rows in another table based on a foreign-key * relationship). - * <p/> + * <br> * A Table instance is not thread-safe (see {@link Database} for more * thread-safety details). * @@ -160,14 +160,14 @@ public interface Table extends Iterable<Row> public Index getForeignKeyIndex(Table otherTable); /** - * Converts a map of columnName -> columnValue to an array of row values + * Converts a map of columnName -> columnValue to an array of row values * appropriate for a call to {@link #addRow(Object...)}. * @usage _general_method_ */ public Object[] asRow(Map<String,?> rowMap); /** - * Converts a map of columnName -> columnValue to an array of row values + * Converts a map of columnName -> columnValue to an array of row values * appropriate for a call to {@link Cursor#updateCurrentRow(Object...)}. * @usage _general_method_ */ @@ -203,7 +203,7 @@ public interface Table extends Iterable<Row> /** * Calls {@link #asRow} on the given row map and passes the result to {@link * #addRow}. - * <p/> + * <br> * Note, if this table has an auto-number column, the value generated will be * put back into the given row map. * @return the given row map, which will contain any autonumbers generated @@ -242,7 +242,7 @@ public interface Table extends Iterable<Row> /** * Calls {@link #asRow} on the given row maps and passes the results to * {@link #addRows}. - * <p/> + * <br> * Note, if this table has an auto-number column, the values generated will * be put back into the appropriate row maps. * <p> @@ -278,7 +278,7 @@ public interface Table extends Iterable<Row> * Iterator which will iterate through all the rows of this table. Use of * the Iterator follows the same restrictions as a call to * {@link #getNextRow}. - * <p/> + * <br> * For more advanced iteration, use the {@link #getDefaultCursor default * cursor} directly. * @throws RuntimeIOException if an IOException is thrown by one of the @@ -296,7 +296,7 @@ public interface Table extends Iterable<Row> public void reset(); /** - * @return The next row in this table (Column name -> Column value) (uses + * @return The next row in this table (Column name -> Column value) (uses * the {@link #getDefaultCursor default cursor}) * @usage _general_method_ */ diff --git a/src/main/java/com/healthmarketscience/jackcess/TableBuilder.java b/src/main/java/com/healthmarketscience/jackcess/TableBuilder.java index 31aa3a0..eaf6b1a 100644 --- a/src/main/java/com/healthmarketscience/jackcess/TableBuilder.java +++ b/src/main/java/com/healthmarketscience/jackcess/TableBuilder.java @@ -32,7 +32,7 @@ import com.healthmarketscience.jackcess.impl.TableCreator; /** * Builder style class for constructing a {@link Table}. - * <p/> + * <br> * Example: * <pre> * Table table = new TableBuilder("Test") diff --git a/src/main/java/com/healthmarketscience/jackcess/expr/TemporalConfig.java b/src/main/java/com/healthmarketscience/jackcess/expr/TemporalConfig.java index db7806f..919d682 100644 --- a/src/main/java/com/healthmarketscience/jackcess/expr/TemporalConfig.java +++ b/src/main/java/com/healthmarketscience/jackcess/expr/TemporalConfig.java @@ -147,8 +147,8 @@ public class TemporalConfig /** * Instantiates a new TemporalConfig with the given configuration. Note * that the date/time format variants will be created by concatenating the - * relevant date and time formats, separated by a single space, e.g. "<date> - * <time>". + * relevant date and time formats, separated by a single space, e.g. "<date> + * <time>". * * @param dateFormat the date (no time) format * @param dateImplicitYearFormat the date (no time) with no year format diff --git a/src/main/java/com/healthmarketscience/jackcess/expr/package-info.java b/src/main/java/com/healthmarketscience/jackcess/expr/package-info.java index 28d9a86..2236c1d 100644 --- a/src/main/java/com/healthmarketscience/jackcess/expr/package-info.java +++ b/src/main/java/com/healthmarketscience/jackcess/expr/package-info.java @@ -20,13 +20,13 @@ limitations under the License. * but can be globally enabled via the system property * "com.healthmarketscience.jackcess.enableExpressionEvaluation" or * selectively enabled on a per database basis using {@link com.healthmarketscience.jackcess.Database#setEvaluateExpressions(Boolean)}. - * <p/> + * <br> * The expression evaluation engine implementation does its best to follow all * the warts and idiosyncracies of Access expression evaluation (both those * that are documented as well as those discovered through experimentation). * These include such things as value conversions, "Null" handling, rounding * rules, and implicit interpretations of expression in certain contexts. - * <p/> + * <br> * Expressions can be used in a number of different places within an Access * database. When enabled, Jackcess supports the following usage: * <ul> @@ -50,14 +50,14 @@ limitations under the License. * record validation rules will be run for the entire record before * update. Failures are handled in a similar manner.</li> * </ul> - * <p/> + * <br> * <h2>Supporting Classes</h2> - * <p/> + * <br> * The classes in this package make up the public api for expression handling * in Jackcess. They generally fall into two categories: - * <p/> + * <br> * <h3>General Use Classes</h3> - * <p/> + * <br> * <ul> * <li>{@link com.healthmarketscience.jackcess.expr.EvalConfig} allows for customization of the expression * evaluation context for a given {@link com.healthmarketscience.jackcess.Database} instance.</li> @@ -72,9 +72,9 @@ limitations under the License. * <li>{@link com.healthmarketscience.jackcess.expr.ParseException} wrapper exception thrown for failures which * occur during expression parsing.</li> * </ul> - * <p/> + * <br> * <h3>Advanced Use Classes</h3> - * <p/> + * <br> * <ul> * <li>{@link com.healthmarketscience.jackcess.expr.EvalContext} encapsulates all shared state for expression * parsing and evaluation.</li> @@ -86,9 +86,9 @@ limitations under the License. * database field).</li> * <li>{@link com.healthmarketscience.jackcess.expr.Value} represents a typed primitive value.</li> * </ul> - * <p/> + * <br> * <h2>Function Support</h2> - * <p/> + * <br> * Jackcess supports many of the standard Access functions. The following * tables list the (hopefully) current status of support built into Jackcess. * diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/CalculatedColumnUtil.java b/src/main/java/com/healthmarketscience/jackcess/impl/CalculatedColumnUtil.java index fb76ad7..141f47f 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/CalculatedColumnUtil.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/CalculatedColumnUtil.java @@ -26,7 +26,7 @@ import com.healthmarketscience.jackcess.InvalidValueException; /** * Utility code for dealing with calculated columns. - * <p/> + * <br> * These are the currently possible calculated types: FLOAT, DOUBLE, INT, * LONG, BIG_INT, GUID, SHORT_DATE_TIME, MONEY, BOOLEAN, NUMERIC, TEXT, MEMO. * diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java b/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java index 18811c3..9858426 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java @@ -36,12 +36,12 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.poi.poifs.filesystem.DirectoryEntry; import org.apache.poi.poifs.filesystem.DocumentEntry; import org.apache.poi.poifs.filesystem.DocumentInputStream; -import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; +import org.apache.poi.poifs.filesystem.POIFSFileSystem; /** * Utility code for working with OLE data which is in the compound storage * format. This functionality relies on the optional POI library. - * <p/> + * <br> * Note that all POI usage is restricted to this file so that the basic ole * support in OleUtil can be utilized without requiring POI. * @@ -57,7 +57,7 @@ public class CompoundOleUtil implements CompoundPackageFactory static { // force a poi class to be loaded to ensure that when this class is // loaded, we know that the poi classes are available - NPOIFSFileSystem.class.getName(); + POIFSFileSystem.class.getName(); } public CompoundOleUtil() @@ -139,7 +139,7 @@ public class CompoundOleUtil implements CompoundPackageFactory extends EmbeddedPackageContentImpl implements CompoundContent { - private NPOIFSFileSystem _fs; + private POIFSFileSystem _fs; private CompoundContentImpl( OleBlobImpl blob, String prettyName, String className, @@ -152,9 +152,9 @@ public class CompoundOleUtil implements CompoundPackageFactory return ContentType.COMPOUND_STORAGE; } - private NPOIFSFileSystem getFileSystem() throws IOException { + private POIFSFileSystem getFileSystem() throws IOException { if(_fs == null) { - _fs = new NPOIFSFileSystem(MemFileChannel.newChannel(getStream(), "r")); + _fs = new POIFSFileSystem(MemFileChannel.newChannel(getStream(), "r")); } return _fs; } diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/CursorImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/CursorImpl.java index 85a53dd..bc24e46 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/CursorImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/CursorImpl.java @@ -299,7 +299,7 @@ public abstract class CursorImpl implements Cursor * Moves to another row in the table based on the given direction and * returns it. * @param columnNames Only column names in this collection will be returned - * @return another row in this table (Column name -> Column value), where + * @return another row in this table (Column name -> Column value), where * "next" may be backwards if moveForward is {@code false}, or * {@code null} if there is not another row in the given direction. */ diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/IndexData.java b/src/main/java/com/healthmarketscience/jackcess/impl/IndexData.java index 341859d..f210a0a 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/IndexData.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/IndexData.java @@ -41,17 +41,17 @@ import org.apache.commons.logging.LogFactory; * Access table index data. This is the actual data which backs a logical * Index, where one or more logical indexes can be backed by the same index * data. - * + * * @author Tim McCune */ public class IndexData { - + protected static final Log LOG = LogFactory.getLog(Index.class); /** special entry which is less than any other entry */ public static final Entry FIRST_ENTRY = createSpecialEntry(RowIdImpl.FIRST_ROW_ID); - + /** special entry which is greater than any other entry */ public static final Entry LAST_ENTRY = createSpecialEntry(RowIdImpl.LAST_ROW_ID); @@ -65,12 +65,12 @@ public class IndexData { public static final Object MIN_VALUE = new Object(); private static final DataPage NEW_ROOT_DATA_PAGE = new RootDataPage(); - - protected static final int INVALID_INDEX_PAGE_NUMBER = 0; - + + protected static final int INVALID_INDEX_PAGE_NUMBER = 0; + /** Max number of columns in an index */ public static final int MAX_COLUMNS = 10; - + protected static final byte[] EMPTY_PREFIX = new byte[0]; static final short COLUMN_UNUSED = -1; @@ -85,7 +85,7 @@ public class IndexData { private static final int MAGIC_INDEX_NUMBER = 1923; private static final ByteOrder ENTRY_BYTE_ORDER = ByteOrder.BIG_ENDIAN; - + /** type attributes for Entries which simplify comparisons */ public enum EntryType { /** comparable type indicating this Entry should always compare less than @@ -104,7 +104,7 @@ public class IndexData { than valid RowIds */ ALWAYS_LAST; } - + public static final Comparator<byte[]> BYTE_CODE_COMPARATOR = new Comparator<byte[]>() { public int compare(byte[] left, byte[] right) { @@ -131,8 +131,8 @@ public class IndexData { ((left.length > right.length) ? 1 : 0)); } }; - - + + /** name, generated on demand */ private String _name; /** owning table */ @@ -175,7 +175,7 @@ public class IndexData { private String _unsupportedReason; /** Cache which manages the index pages */ private final IndexPageCache _pageCache; - + protected IndexData(TableImpl table, int number, int uniqueEntryCount, int uniqueEntryCountOffset) { @@ -216,14 +216,14 @@ public class IndexData { } else { _name = String.valueOf(_number); } - } + } return _name; } public TableImpl getTable() { return _table; } - + public JetFormat getFormat() { return getTable().getFormat(); } @@ -280,7 +280,7 @@ public class IndexData { public int getIndexDataNumber() { return _number; } - + public int getUniqueEntryCount() { return _uniqueEntryCount; } @@ -315,7 +315,7 @@ public class IndexData { public boolean isUnique() { return(isBackingPrimaryKey() || ((_indexFlags & UNIQUE_INDEX_FLAG) != 0)); } - + /** * Whether or not values are required in the columns. */ @@ -345,7 +345,7 @@ public class IndexData { return _rootPageNumber; } - private void setUnsupportedReason(String reason, ColumnImpl col) { + private void setUnsupportedReason(String reason, ColumnImpl col) { _unsupportedReason = withErrorContext(reason); if(!col.getTable().isSystem()) { LOG.warn(_unsupportedReason + ", making read-only"); @@ -371,7 +371,7 @@ public class IndexData { public int getOwnedPageCount() { return _ownedPages.getPageCount(); } - + void addOwnedPage(int pageNumber) throws IOException { _ownedPages.addPageNumber(pageNumber); } @@ -379,7 +379,7 @@ public class IndexData { void collectUsageMapPages(Collection<Integer> pages) { pages.add(_ownedPages.getTablePageNumber()); } - + /** * Used by unit tests to validate the internal status of the index. * @usage _advanced_method_ @@ -407,7 +407,7 @@ public class IndexData { } return count; } - + /** * Forces initialization of this index (actual parsing of index pages). * normally, the index will not be initialized until the entries are @@ -429,7 +429,7 @@ public class IndexData { { // make sure we've parsed the entries initialize(); - + if(_unsupportedReason != null) { throw new UnsupportedOperationException( "Cannot write indexes of this type due to " + _unsupportedReason); @@ -470,7 +470,7 @@ public class IndexData { } _ownedPages = UsageMap.read(getTable().getDatabase(), tableBuffer); - + _rootPageNumber = tableBuffer.getInt(); ByteUtil.forward(tableBuffer, getFormat().SKIP_BEFORE_INDEX_FLAGS); //Forward past Unknown @@ -525,7 +525,7 @@ public class IndexData { * @param buffer Buffer to write to */ protected static void writeDefinition( - TableMutator creator, ByteBuffer buffer, + TableMutator creator, ByteBuffer buffer, TableMutator.IndexDataState idxDataState, ByteBuffer rootPageBuffer) throws IOException { @@ -559,7 +559,7 @@ public class IndexData { creator.getDatabase(), creator.getTableName(), idx.getName())); } } - + buffer.putShort(columnNumber); // table column number buffer.put(flags); // column flags (e.g. ordering) } @@ -568,7 +568,7 @@ public class IndexData { ByteUtil.put3ByteInt(buffer, idxDataState.getUmapPageNumber()); // umap page // write empty root index page - creator.getPageChannel().writePage(rootPageBuffer, + creator.getPageChannel().writePage(rootPageBuffer, idxDataState.getRootPageNumber()); buffer.putInt(idxDataState.getRootPageNumber()); @@ -577,11 +577,11 @@ public class IndexData { ByteUtil.forward(buffer, 5); // unknown } - private static ByteBuffer createRootPageBuffer(TableMutator creator) + private static ByteBuffer createRootPageBuffer(TableMutator creator) throws IOException { ByteBuffer rootPageBuffer = creator.getPageChannel().createPageBuffer(); - writeDataPage(rootPageBuffer, NEW_ROOT_DATA_PAGE, + writeDataPage(rootPageBuffer, NEW_ROOT_DATA_PAGE, creator.getTdefPageNumber(), creator.getFormat()); return rootPageBuffer; } @@ -591,7 +591,7 @@ public class IndexData { * this method returns. * <p> * Forces index initialization. - * + * * @param row Row to add * @param rowId rowId of the row to be added * @@ -603,7 +603,7 @@ public class IndexData { { return prepareAddRow(row, rowId, new AddRowPendingChange(nextChange)); } - + private PendingChange prepareAddRow(Object[] row, RowIdImpl rowId, AddRowPendingChange change) throws IOException @@ -619,7 +619,7 @@ public class IndexData { "Null value found in row " + Arrays.asList(row) + " for primary key or required index")); } - + // make sure we've parsed the entries initialize(); @@ -637,14 +637,14 @@ public class IndexData { DataPage dataPage = findDataPage(newEntry); int idx = dataPage.findEntry(newEntry); if(idx < 0) { - + // this is a new entry idx = missingIndexToInsertionPoint(idx); Position newPos = new Position(dataPage, idx, newEntry, true); Position nextPos = getNextPosition(newPos); Position prevPos = getPreviousPosition(newPos); - + // determine if the addition of this entry would break the uniqueness // constraint. See isUnique() for some notes about uniqueness as // defined by Access. @@ -691,7 +691,7 @@ public class IndexData { * before this method returns. * <p> * Forces index initialization. - * + * * @param oldRow Row to be removed * @param newRow Row to be added * @param rowId rowId of the row to be updated @@ -699,7 +699,7 @@ public class IndexData { * @return a PendingChange which can complete the update or roll it back */ public PendingChange prepareUpdateRow(Object[] oldRow, RowIdImpl rowId, - Object[] newRow, + Object[] newRow, PendingChange nextChange) throws IOException { @@ -715,12 +715,12 @@ public class IndexData { throw e; } } - + /** * Removes a row from this index * <p> * Forces index initialization. - * + * * @param row Row to remove * @param rowId rowId of the row to be removed */ @@ -729,7 +729,7 @@ public class IndexData { { deleteRowImpl(row, rowId); } - + private Entry deleteRowImpl(Object[] row, RowIdImpl rowId) throws IOException { @@ -738,7 +738,7 @@ public class IndexData { // nothing to do return null; } - + // make sure we've parsed the entries initialize(); @@ -748,7 +748,7 @@ public class IndexData { ++_modCount; } else { LOG.warn(withErrorContext( - "Failed removing index entry " + oldEntry + " for row: " + + "Failed removing index entry " + oldEntry + " for row: " + Arrays.asList(row))); } return removedEntry; @@ -773,7 +773,7 @@ public class IndexData { dataPage.addEntry(missingIndexToInsertionPoint(idx), removedEntry); } } - + /** * Removes an entry from the relevant index dataPage, maintaining the order. * Will search by RowId if entry is not found (in case a partial entry was @@ -810,10 +810,10 @@ public class IndexData { // found it! removedEntry = dataPage.removeEntry(idx); } - + return removedEntry; } - + public static void commitAll(PendingChange change) throws IOException { while(change != null) { change.commit(); @@ -827,7 +827,7 @@ public class IndexData { change = change.getNext(); } } - + /** * Gets a new cursor for this index. * <p> @@ -838,13 +838,13 @@ public class IndexData { { return cursor(null, true, null, true); } - + /** * Gets a new cursor for this index, narrowed to the range defined by the * given startRow and endRow. * <p> * Forces index initialization. - * + * * @param startRow the first row of data for the cursor, or {@code null} for * the first entry * @param startInclusive whether or not startRow is inclusive or exclusive @@ -1008,13 +1008,13 @@ public class IndexData { int valIdx = 0; Object[] idxRow = new Object[getTable().getColumnCount()]; for(ColumnDescriptor col : _columns) { - idxRow[col.getColumnIndex()] = + idxRow[col.getColumnIndex()] = ((valIdx < values.length) ? values[valIdx] : filler); ++valIdx; } return idxRow; } - + /** * Constructs an array of values appropriate for this index from the given * column value. @@ -1057,7 +1057,7 @@ public class IndexData { idxRow[col.getColumnIndex()] = row.get(col.getName()); } return idxRow; - } + } /** * Constructs an array of values appropriate for this index from the given @@ -1088,7 +1088,7 @@ public class IndexData { Object[] idxRow = new Object[getTable().getColumnCount()]; int valIdx = 0; for(ColumnDescriptor col : _columns) { - idxRow[col.getColumnIndex()] = + idxRow[col.getColumnIndex()] = ((valIdx < numCols) ? row.get(col.getName()) : filler); ++valIdx; } @@ -1116,7 +1116,7 @@ public class IndexData { sb.append("pageCache", _pageCache); return sb.toString(); } - + /** * Write the given index page out to a buffer */ @@ -1126,7 +1126,7 @@ public class IndexData { if(dataPage.getCompressedEntrySize() > _maxPageEntrySize) { throw new IllegalStateException(withErrorContext("data page is too large")); } - + ByteBuffer buffer = _indexBufferH.getPageBuffer(getPageChannel()); writeDataPage(buffer, dataPage, getTable().getTableDefPageNumber(), @@ -1170,7 +1170,7 @@ public class IndexData { // first entry includes the prefix buffer.put(entryPrefix); - + for(Entry entry : dataPage.getEntries()) { entry.write(buffer, entryPrefix); } @@ -1232,7 +1232,7 @@ public class IndexData { "Unexpected order in index entries, " + prevEntry + " >= " + entry)); } - + entries.add(entry); if((entries.size() == 1) && (entryPrefixLength > 0)) { @@ -1251,7 +1251,7 @@ public class IndexData { dataPage.setEntryPrefix(entryPrefix != null ? entryPrefix : EMPTY_PREFIX); dataPage.setEntries(entries); dataPage.setTotalEntrySize(totalEntrySize); - + int prevPageNumber = buffer.getInt(getFormat().OFFSET_PREV_INDEX_PAGE); int nextPageNumber = buffer.getInt(getFormat().OFFSET_NEXT_INDEX_PAGE); int childTailPageNumber = @@ -1265,7 +1265,7 @@ public class IndexData { /** * Returns a new Entry of the correct type for the given data and page type. */ - private static Entry newEntry(ByteBuffer buffer, int entryLength, + private static Entry newEntry(ByteBuffer buffer, int entryLength, boolean isLeaf) throws IOException { @@ -1291,10 +1291,10 @@ public class IndexData { tmpEntryBuffer.put(valuePrefix); tmpEntryBuffer.put(indexPage.array(), indexPage.position(), entryLen); tmpEntryBuffer.flip(); - + return tmpEntryBuffer; } - + /** * Determines if the given index page is a leaf or node page. */ @@ -1309,7 +1309,7 @@ public class IndexData { } throw new IOException(withErrorContext("Unexpected page type " + pageType)); } - + /** * Determines the number of {@code null} values for this index from the * given row. @@ -1319,7 +1319,7 @@ public class IndexData { if(values == null) { return _columns.size(); } - + // annoyingly, the values array could come from different sources, one // of which will make it a different size than the other. we need to // handle both situations. @@ -1330,7 +1330,7 @@ public class IndexData { ++nullCount; } } - + return nullCount; } @@ -1342,12 +1342,12 @@ public class IndexData { if(values == null) { return null; } - + if(_entryBuffer == null) { _entryBuffer = new ByteStream(); } _entryBuffer.reset(); - + for(ColumnDescriptor col : _columns) { Object value = values[col.getColumnIndex()]; @@ -1373,9 +1373,9 @@ public class IndexData { col.writeValue(value, _entryBuffer); } - + return _entryBuffer.toByteArray(); - } + } /** * Finds the data page for the given entry. @@ -1385,7 +1385,7 @@ public class IndexData { { return _pageCache.findCacheDataPage(entry); } - + /** * Gets the data page for the pageNumber. */ @@ -1394,7 +1394,7 @@ public class IndexData { { return _pageCache.getCacheDataPage(pageNumber); } - + /** * Flips the first bit in the byte at the given index. */ @@ -1418,7 +1418,7 @@ public class IndexData { static byte[] flipBytes(byte[] value, int offset, int length) { for(int i = offset; i < (offset + length); ++i) { value[i] = (byte)(~value[i]); - } + } return value; } @@ -1430,7 +1430,7 @@ public class IndexData { { // always write in big endian order return column.write(value, 0, ENTRY_BYTE_ORDER).array(); - } + } /** * Writes a binary value using the general binary entry encoding rules. @@ -1452,7 +1452,7 @@ public class IndexData { // bit twiddling rules: // - isAsc => nothing - // - !isAsc => flipBytes, _but keep intermediate 09 unflipped_! + // - !isAsc => flipBytes, _but keep intermediate 09 unflipped_! // first, write any intermediate segements int segmentLen = dataLen; @@ -1549,7 +1549,7 @@ public class IndexData { default: // we can't modify this index at this point in time - setUnsupportedReason("unsupported data type " + col.getType() + + setUnsupportedReason("unsupported data type " + col.getType() + " for index", col); return new ReadOnlyColumnDescriptor(col, flags); } @@ -1598,7 +1598,7 @@ public class IndexData { return msg + " (Db=" + db.getName() + ";Table=" + tableName + ";Index=" + idxName + ")"; } - + /** * Information about the columns in an index. Also encodes new index * values. @@ -1626,11 +1626,11 @@ public class IndexData { public boolean isAscending() { return((getFlags() & ASCENDING_COLUMN_FLAG) != 0); } - + public int getColumnIndex() { return getColumn().getColumnIndex(); } - + public String getName() { return getColumn().getName(); } @@ -1638,7 +1638,7 @@ public class IndexData { protected boolean isNullValue(Object value) { return (value == null); } - + protected final void writeValue(Object value, ByteStream bout) throws IOException { @@ -1647,7 +1647,7 @@ public class IndexData { bout.write(getNullEntryFlag(isAscending())); return; } - + // write the start flag bout.write(getStartEntryFlag(isAscending())); // write the rest of the value @@ -1655,8 +1655,8 @@ public class IndexData { } protected abstract void writeNonNullValue(Object value, ByteStream bout) - throws IOException; - + throws IOException; + @Override public String toString() { return CustomToStringStyle.builder(this) @@ -1676,26 +1676,26 @@ public class IndexData { { super(column, flags); } - + @Override protected void writeNonNullValue(Object value, ByteStream bout) throws IOException { byte[] valueBytes = encodeNumberColumnValue(value, getColumn()); - + // bit twiddling rules: // - isAsc => flipFirstBit // - !isAsc => flipFirstBit, flipBytes - + flipFirstBitInByte(valueBytes, 0); if(!isAscending()) { flipBytes(valueBytes); } - + bout.write(valueBytes); - } + } } - + /** * ColumnDescriptor for floating point based columns. */ @@ -1707,13 +1707,13 @@ public class IndexData { { super(column, flags); } - + @Override protected void writeNonNullValue(Object value, ByteStream bout) throws IOException { byte[] valueBytes = encodeNumberColumnValue(value, getColumn()); - + // determine if the number is negative by testing if the first bit is // set boolean isNegative = ((valueBytes[0] & 0x80) != 0); @@ -1723,18 +1723,18 @@ public class IndexData { // isAsc && isNeg => flipBytes // !isAsc && !isNeg => flipFirstBit, flipBytes // !isAsc && isNeg => nothing - + if(!isNegative) { flipFirstBitInByte(valueBytes, 0); } if(isNegative == isAscending()) { flipBytes(valueBytes); } - + bout.write(valueBytes); - } + } } - + /** * ColumnDescriptor for fixed point based columns (legacy sort order). */ @@ -1755,15 +1755,15 @@ public class IndexData { } // reverse the sign byte (after any previous byte flipping) - valueBytes[0] = (isNegative ? (byte)0x00 : (byte)0xFF); + valueBytes[0] = (isNegative ? (byte)0x00 : (byte)0xFF); } - + @Override protected void writeNonNullValue(Object value, ByteStream bout) throws IOException { byte[] valueBytes = encodeNumberColumnValue(value, getColumn()); - + // determine if the number is negative by testing if the first bit is // set boolean isNegative = ((valueBytes[0] & 0x80) != 0); @@ -1773,7 +1773,7 @@ public class IndexData { // isAsc && isNeg => flipBytes, setReverseSignByte => 00 FF FF ... // !isAsc && !isNeg => flipBytes, setReverseSignByte => FF FF FF ... // !isAsc && isNeg => setReverseSignByte => 00 00 00 ... - + // v2007 bit twiddling rules (old ordering was a bug, MS kb 837148): // isAsc && !isNeg => setSignByte 0xFF => FF 00 00 ... // isAsc && isNeg => setSignByte 0xFF, flipBytes => 00 FF FF ... @@ -1782,9 +1782,9 @@ public class IndexData { handleNegationAndOrder(isNegative, valueBytes); bout.write(valueBytes); - } + } } - + /** * ColumnDescriptor for new-style fixed point based columns. */ @@ -1796,7 +1796,7 @@ public class IndexData { { super(column, flags); } - + @Override protected void handleNegationAndOrder(boolean isNegative, byte[] valueBytes) @@ -1809,9 +1809,9 @@ public class IndexData { if(isNegative == isAscending()) { flipBytes(valueBytes); } - } + } } - + /** * ColumnDescriptor for byte based columns. */ @@ -1822,24 +1822,24 @@ public class IndexData { { super(column, flags); } - + @Override protected void writeNonNullValue(Object value, ByteStream bout) throws IOException { byte[] valueBytes = encodeNumberColumnValue(value, getColumn()); - + // bit twiddling rules: // - isAsc => nothing // - !isAsc => flipBytes if(!isAscending()) { flipBytes(valueBytes); } - + bout.write(valueBytes); - } + } } - + /** * ColumnDescriptor for boolean columns. */ @@ -1856,7 +1856,7 @@ public class IndexData { // null values are handled as booleans return false; } - + @Override protected void writeNonNullValue(Object value, ByteStream bout) throws IOException @@ -1867,11 +1867,11 @@ public class IndexData { (isAscending() ? ASC_BOOLEAN_FALSE : DESC_BOOLEAN_FALSE)); } } - + /** * ColumnDescriptor for "general legacy" sort order text based columns. */ - private static final class GenLegTextColumnDescriptor + private static final class GenLegTextColumnDescriptor extends ColumnDescriptor { private GenLegTextColumnDescriptor(ColumnImpl column, byte flags) @@ -1879,14 +1879,14 @@ public class IndexData { { super(column, flags); } - + @Override protected void writeNonNullValue(Object value, ByteStream bout) throws IOException { GeneralLegacyIndexCodes.GEN_LEG_INSTANCE.writeNonNullIndexTextValue( value, bout, isAscending()); - } + } } /** @@ -1899,14 +1899,14 @@ public class IndexData { { super(column, flags); } - + @Override protected void writeNonNullValue(Object value, ByteStream bout) throws IOException { GeneralIndexCodes.GEN_INSTANCE.writeNonNullIndexTextValue( value, bout, isAscending()); - } + } } /** @@ -1919,7 +1919,7 @@ public class IndexData { { super(column, flags); } - + @Override protected void writeNonNullValue(Object value, ByteStream bout) throws IOException @@ -1929,7 +1929,7 @@ public class IndexData { bout); } } - + /** * ColumnDescriptor for BINARY columns. @@ -1950,8 +1950,8 @@ public class IndexData { ColumnImpl.toByteArray(value), isAscending(), bout); } } - - + + /** * ColumnDescriptor for columns which we cannot currently write. */ @@ -1971,7 +1971,7 @@ public class IndexData { "Cannot write indexes of this type due to " + _unsupportedReason); } } - + /** * A single leaf entry in an index (points to a single row) */ @@ -1983,7 +1983,7 @@ public class IndexData { private final byte[] _entryBytes; /** comparable type for the entry */ private final EntryType _type; - + /** * Create a new entry * @param entryBytes encoded bytes for this index entry @@ -1995,7 +1995,7 @@ public class IndexData { _entryBytes = entryBytes; _type = type; } - + /** * Create a new entry * @param entryBytes encoded bytes for this index entry @@ -2014,7 +2014,7 @@ public class IndexData { { this(buffer, entryLen, 0); } - + /** * Read an existing entry in from a buffer */ @@ -2031,11 +2031,11 @@ public class IndexData { // read the rowId int page = ByteUtil.get3ByteInt(buffer, ENTRY_BYTE_ORDER); int row = ByteUtil.getUnsignedByte(buffer); - + _rowId = new RowIdImpl(page, row); _type = EntryType.NORMAL; } - + public RowIdImpl getRowId() { return _rowId; } @@ -2047,11 +2047,11 @@ public class IndexData { public Integer getSubPageNumber() { throw new UnsupportedOperationException(); } - + public boolean isLeafEntry() { return true; } - + public boolean isValid() { return(_entryBytes != null); } @@ -2059,7 +2059,7 @@ public class IndexData { protected final byte[] getEntryBytes() { return _entryBytes; } - + /** * Size of this entry in the db. */ @@ -2067,7 +2067,7 @@ public class IndexData { // need 4 trailing bytes for the rowId return _entryBytes.length + 4; } - + /** * Write this entry into a buffer */ @@ -2076,15 +2076,15 @@ public class IndexData { throws IOException { if(prefix.length <= _entryBytes.length) { - + // write entry bytes, not including prefix buffer.put(_entryBytes, prefix.length, (_entryBytes.length - prefix.length)); ByteUtil.put3ByteInt(buffer, getRowId().getPageNumber(), ENTRY_BYTE_ORDER); - + } else if(prefix.length <= (_entryBytes.length + 3)) { - + // the prefix includes part of the page number, write to temp buffer // and copy last bytes to output buffer ByteBuffer tmp = ByteBuffer.allocate(3); @@ -2093,16 +2093,16 @@ public class IndexData { tmp.flip(); tmp.position(prefix.length - _entryBytes.length); buffer.put(tmp); - + } else { - + // since the row number would never be the same if the page number is // the same, nothing past the page number should ever be included in // the prefix. // FIXME, this could happen if page has only one row... throw new IllegalStateException("prefix should never be this long"); } - + buffer.put((byte)getRowId().getRowNumber()); } @@ -2113,7 +2113,7 @@ public class IndexData { } return sb; } - + @Override public String toString() { return entryBytesToStringBuilder( @@ -2141,7 +2141,7 @@ public class IndexData { public boolean equalsEntryBytes(Entry o) { return(BYTE_CODE_COMPARATOR.compare(_entryBytes, o._entryBytes) == 0); } - + public int compareTo(Entry other) { if (this == other) { return 0; @@ -2165,7 +2165,7 @@ public class IndexData { return typeCmp; } } - + // at this point we let the RowId decide the final result return _rowId.compareTo(other.getRowId()); } @@ -2177,7 +2177,7 @@ public class IndexData { protected Entry asNodeEntry(Integer subPageNumber) { return new NodeEntry(_entryBytes, _rowId, _type, subPageNumber); } - + } /** @@ -2200,7 +2200,7 @@ public class IndexData { super(entryBytes, rowId, type); _subPageNumber = subPageNumber; } - + /** * Read an existing node entry in from a buffer */ @@ -2222,19 +2222,19 @@ public class IndexData { public boolean isLeafEntry() { return false; } - + @Override protected int size() { // need 4 trailing bytes for the sub-page number return super.size() + 4; } - + @Override protected void write(ByteBuffer buffer, byte[] prefix) throws IOException { super.write(buffer, prefix); ByteUtil.putInt(buffer, _subPageNumber, ENTRY_BYTE_ORDER); } - + @Override public boolean equals(Object o) { return((this == o) || @@ -2250,7 +2250,7 @@ public class IndexData { .append("rowId", getRowId()) .append("subPage", _subPageNumber)) .toString(); - } + } } /** @@ -2298,14 +2298,14 @@ public class IndexData { private int getIndexModCount() { return IndexData.this._modCount; } - + /** * Returns the first entry (exclusive) as defined by this cursor. */ public Entry getFirstEntry() { return _firstPos.getEntry(); } - + /** * Returns the last entry (exclusive) as defined by this cursor. */ @@ -2320,7 +2320,7 @@ public class IndexData { public boolean isUpToDate() { return(getIndexModCount() == _lastModCount); } - + public void reset() { beforeFirst(); } @@ -2341,26 +2341,26 @@ public class IndexData { /** * Repositions the cursor so that the next row will be the first entry - * >= the given row. + * >= the given row. */ public void beforeEntry(Object[] row) throws IOException { - restorePosition(new Entry(IndexData.this.createEntryBytes(row), + restorePosition(new Entry(IndexData.this.createEntryBytes(row), RowIdImpl.FIRST_ROW_ID)); } - + /** * Repositions the cursor so that the previous row will be the first - * entry <= the given row. + * entry <= the given row. */ public void afterEntry(Object[] row) throws IOException { - restorePosition(new Entry(IndexData.this.createEntryBytes(row), + restorePosition(new Entry(IndexData.this.createEntryBytes(row), RowIdImpl.LAST_ROW_ID)); } - + /** * @return valid entry if there was a next entry, * {@code #getLastEntry} otherwise @@ -2386,7 +2386,7 @@ public class IndexData { { restorePosition(curEntry, _curPos.getEntry()); } - + /** * Restores a current and previous position for the cursor. */ @@ -2406,7 +2406,7 @@ public class IndexData { checkForModification(); } } - + /** * Gets another entry in the given direction, returning the new entry. */ @@ -2462,7 +2462,7 @@ public class IndexData { withErrorContext("Invalid entry given " + entry)); } } - + Position pos = findEntryPosition(entry); if(pos.compareTo(_lastPos) >= 0) { return _lastPos; @@ -2471,7 +2471,7 @@ public class IndexData { } return pos; } - + /** * Updates any the boundary info (_firstPos/_lastPos). */ @@ -2481,7 +2481,7 @@ public class IndexData { _firstPos = findEntryPosition(_firstPos.getEntry()); _lastPos = findEntryPosition(_lastPos.getEntry()); } - + @Override public String toString() { return CustomToStringStyle.valueBuilder(this) @@ -2489,7 +2489,7 @@ public class IndexData { .append("prevPosition", _prevPos) .toString(); } - + /** * Handles moving the cursor in a given direction. Separates cursor * logic from value storage. @@ -2500,7 +2500,7 @@ public class IndexData { public abstract Position getBeginningPosition(); public abstract Position getEndPosition(); } - + /** * Handles moving the cursor forward. */ @@ -2524,7 +2524,7 @@ public class IndexData { return _lastPos; } } - + /** * Handles moving the cursor backward. */ @@ -2569,7 +2569,7 @@ public class IndexData { { this(dataPage, idx, dataPage.getEntries().get(idx), false); } - + private Position(DataPage dataPage, int idx, Entry entry, boolean between) { _dataPage = dataPage; @@ -2581,7 +2581,7 @@ public class IndexData { public DataPage getDataPage() { return _dataPage; } - + public int getIndex() { return _idx; } @@ -2598,7 +2598,7 @@ public class IndexData { // non-between case return(_idx - 1); } - + public Entry getEntry() { return _entry; } @@ -2610,7 +2610,7 @@ public class IndexData { public boolean equalsEntry(Entry entry) { return _entry.equals(entry); } - + public int compareTo(Position other) { if(this == other) { @@ -2627,16 +2627,16 @@ public class IndexData { return idxCmp; } } - + // compare the entries. return _entry.compareTo(other._entry); } - + @Override public int hashCode() { return _entry.hashCode(); } - + @Override public boolean equals(Object o) { return((this == o) || @@ -2661,7 +2661,7 @@ public class IndexData { protected static abstract class DataPage { public abstract int getPageNumber(); - + public abstract boolean isLeaf(); public abstract void setLeaf(boolean isLeaf); @@ -2671,7 +2671,7 @@ public class IndexData { public abstract void setNextPageNumber(int pageNumber); public abstract int getChildTailPageNumber(); public abstract void setChildTailPageNumber(int pageNumber); - + public abstract int getTotalEntrySize(); public abstract void setTotalEntrySize(int totalSize); public abstract byte[] getEntryPrefix(); @@ -2688,7 +2688,7 @@ public class IndexData { public final boolean isEmpty() { return getEntries().isEmpty(); } - + public final int getCompressedEntrySize() { // when written to the index page, the entryPrefix bytes will only be // written for the first entry, so we subtract the entry prefix size @@ -2717,7 +2717,7 @@ public class IndexData { public final String toString() { List<Entry> entries = getEntries(); - String objName = + String objName = (isLeaf() ? "Leaf" : "Node") + "DataPage[" + getPageNumber() + "] " + getPrevPageNumber() + ", " + getNextPageNumber() + ", (" + getChildTailPageNumber() + ")"; @@ -2740,7 +2740,7 @@ public class IndexData { @Override public int getPageNumber() { return 0; } - + @Override public boolean isLeaf() { return true; } @Override @@ -2760,7 +2760,7 @@ public class IndexData { public int getChildTailPageNumber() { return 0; } @Override public void setChildTailPageNumber(int pageNumber) { } - + @Override public int getTotalEntrySize() { return 0; } @Override @@ -2772,7 +2772,7 @@ public class IndexData { public void setEntryPrefix(byte[] entryPrefix) { } @Override - public List<Entry> getEntries() { return Collections.emptyList(); } + public List<Entry> getEntries() { return Collections.emptyList(); } @Override public void setEntries(List<Entry> entries) { } @Override @@ -2800,7 +2800,7 @@ public class IndexData { public PendingChange getNext() { return _next; } - + /** * Completes the pending change. */ @@ -2827,7 +2827,7 @@ public class IndexData { super(next); } - public void setAddRow(Entry addEntry, DataPage dataPage, int idx, + public void setAddRow(Entry addEntry, DataPage dataPage, int idx, boolean isDupe) { _addEntry = addEntry; _addDataPage = dataPage; @@ -2843,7 +2843,7 @@ public class IndexData { public void commit() throws IOException { commitAddRow(_addEntry, _addDataPage, _addIdx, _isDupe, _oldEntry); } - + @Override public void rollback() throws IOException { _addEntry = null; diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/RowImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/RowImpl.java index ee088f4..66d9c80 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/RowImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/RowImpl.java @@ -27,8 +27,8 @@ import com.healthmarketscience.jackcess.util.OleBlob; /** - * A row of data as column->value pairs. - * </p> + * A row of data as column->value pairs. + * <br> * Note that the {@link #equals} and {@link #hashCode} methods work on the row * contents <i>only</i> (i.e. they ignore the id). * @@ -36,7 +36,7 @@ import com.healthmarketscience.jackcess.util.OleBlob; */ public class RowImpl extends LinkedHashMap<String,Object> implements Row { - private static final long serialVersionUID = 20130314L; + private static final long serialVersionUID = 20130314L; private final RowIdImpl _id; diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java index e065f05..9f6ae49 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java @@ -2086,7 +2086,7 @@ public class TableImpl implements Table, PropertyMaps.Owner } /** - * Converts a map of columnName -> columnValue to an array of row values + * Converts a map of columnName -> columnValue to an array of row values * appropriate for a call to {@link #addRow(Object...)}, where the generated * RowId will be an extra value at the end of the array. * @see ColumnImpl#RETURN_ROW_ID @@ -2110,7 +2110,7 @@ public class TableImpl implements Table, PropertyMaps.Owner } /** - * Converts a map of columnName -> columnValue to an array of row values. + * Converts a map of columnName -> columnValue to an array of row values. */ private Object[] asRow(Map<String,?> rowMap, Object defaultValue, boolean returnRowId) diff --git a/src/main/java/com/healthmarketscience/jackcess/util/MemFileChannel.java b/src/main/java/com/healthmarketscience/jackcess/util/MemFileChannel.java index 528ddbb..9ff542f 100644 --- a/src/main/java/com/healthmarketscience/jackcess/util/MemFileChannel.java +++ b/src/main/java/com/healthmarketscience/jackcess/util/MemFileChannel.java @@ -41,11 +41,11 @@ import com.healthmarketscience.jackcess.impl.DatabaseImpl; * where disk usage may not be possible or desirable). Obviously, this * requires enough jvm heap space to fit the file data. Use one of the * {@code newChannel()} methods to construct an instance of this class. - * <p/> + * <br> * In order to use this class with a Database, you <i>must</i> use the {@link * DatabaseBuilder} to open/create the Database instance, passing an instance * of this class to the {@link DatabaseBuilder#setChannel} method. - * <p/> + * <br> * Implementation note: this class is optimized for use with {@link Database}. * Therefore not all methods may be implemented and individual read/write * operations are only supported within page boundaries. diff --git a/src/main/java/com/healthmarketscience/jackcess/util/OleBlob.java b/src/main/java/com/healthmarketscience/jackcess/util/OleBlob.java index 8a775ad..4a85e13 100644 --- a/src/main/java/com/healthmarketscience/jackcess/util/OleBlob.java +++ b/src/main/java/com/healthmarketscience/jackcess/util/OleBlob.java @@ -34,7 +34,7 @@ import com.healthmarketscience.jackcess.impl.OleUtil; * with nested filesystems!), and jackcess only supports a small portion of * it. That said, jackcess should support the bulk of the common * functionality. - * <p/> + * <br> * The main Blob methods will interact with the <i>entire</i> OLE field data * which, in most cases, contains additional wrapper information. In order to * access the ultimate "content" contained within the OLE data, the {@link @@ -42,15 +42,15 @@ import com.healthmarketscience.jackcess.impl.OleUtil; * variety of formats, so additional sub-interfaces are available to interact * with it. The most specific sub-interface can be determined by the {@link * ContentType} of the Content. - * <p/> + * <br> * Once an OleBlob is no longer useful, <i>it should be closed</i> using * {@link #free} or {@link #close} methods (after which, the instance will no * longer be functional). - * <p/> + * <br> * Note, the OleBlob implementation is read-only (through the interface). In * order to modify blob contents, create a new OleBlob instance using {@link * OleBlob.Builder} and write it to the access database. - * <p/> + * <br> * <b>Example for interpreting an existing OLE field:</b> * <pre> * OleBlob oleBlob = null; @@ -66,7 +66,7 @@ import com.healthmarketscience.jackcess.impl.OleUtil; * if(oleBlob != null) { oleBlob.close(); } * } * </pre> - * <p/> + * <br> * <b>Example for creating new, embedded ole data:</b> * <pre> * OleBlob oleBlob = null; @@ -79,7 +79,7 @@ import com.healthmarketscience.jackcess.impl.OleUtil; * if(oleBlob != null) { oleBlob.close(); } * } * </pre> - * <p/> + * <br> * <b>Example for creating new, linked ole data:</b> * <pre> * OleBlob oleBlob = null; diff --git a/src/main/java/com/healthmarketscience/jackcess/util/ReadOnlyFileChannel.java b/src/main/java/com/healthmarketscience/jackcess/util/ReadOnlyFileChannel.java index 85620e8..0fb6f50 100644 --- a/src/main/java/com/healthmarketscience/jackcess/util/ReadOnlyFileChannel.java +++ b/src/main/java/com/healthmarketscience/jackcess/util/ReadOnlyFileChannel.java @@ -28,7 +28,7 @@ import com.healthmarketscience.jackcess.Database; /** * Wrapper for existing FileChannel which is read-only. - * <p/> + * <br> * Implementation note: this class is optimized for use with {@link Database}. * Therefore not all methods may be implemented. * diff --git a/src/site/javadoc/taglets.properties b/src/site/javadoc/taglets.properties deleted file mode 100644 index b24a1e3..0000000 --- a/src/site/javadoc/taglets.properties +++ /dev/null @@ -1,41 +0,0 @@ -# basic taglets config -Taglets.splash=false -Taglets.verbose=false -Taglets.debug=false -Taglets.drivers= drivers/j2se15.jar, drivers/j2se14.jar - -# custom usage formatting -Taglets.shutdown.usage-tag= net.sourceforge.taglets.simple.shutdown.RegexReplacer -Taglets.shutdown.usage-tag.files= **/*.html -Taglets.shutdown.usage-tag.token.0=_general_method_ -Taglets.shutdown.usage-tag.value.0=<span class="UsageGeneral"><span class="UsageGeneralHeader">General</span>: This method is general use.</span> - -Taglets.shutdown.usage-tag.token.1=_intermediate_method_ -Taglets.shutdown.usage-tag.value.1=<span class="UsageIntermediate"><span class="UsageIntermediateHeader">Intermediate</span>: This method requires moderate API knowledge.</span> - -Taglets.shutdown.usage-tag.token.2=_advanced_method_ -Taglets.shutdown.usage-tag.value.2=<span class="UsageAdvanced"><span class="UsageAdvancedHeader">Advanced</span>: This method is for advanced/internal use.</span> - -Taglets.shutdown.usage-tag.token.3=_general_class_ -Taglets.shutdown.usage-tag.value.3=<span class="UsageGeneral"><span class="UsageGeneralHeader">General</span>: This class is general use.</span> - -Taglets.shutdown.usage-tag.token.4=_intermediate_class_ -Taglets.shutdown.usage-tag.value.4=<span class="UsageIntermediate"><span class="UsageIntermediateHeader">Intermediate</span>: This class requires moderate API knowledge.</span> - -Taglets.shutdown.usage-tag.token.5=_advanced_class_ -Taglets.shutdown.usage-tag.value.5=<span class="UsageAdvanced"><span class="UsageAdvancedHeader">Advanced</span>: This class is for advanced/internal use.</span> - -Taglets.shutdown.usage-tag.token.6=_general_field_ -Taglets.shutdown.usage-tag.value.6=<span class="UsageGeneral"><span class="UsageGeneralHeader">General</span>: This field is general use.</span> - -Taglets.shutdown.usage-tag.token.7=_intermediate_field_ -Taglets.shutdown.usage-tag.value.7=<span class="UsageIntermediate"><span class="UsageIntermediateHeader">Intermediate</span>: This field requires moderate API knowledge.</span> - -Taglets.shutdown.usage-tag.token.8=_advanced_field_ -Taglets.shutdown.usage-tag.value.8=<span class="UsageAdvanced"><span class="UsageAdvancedHeader">Advanced</span>: This field is for advanced/internal use.</span> - - -# apparently we need one "normal" tag or the taglets code gets unhappy -Taglets.taglet.todo= net.sourceforge.taglets.simple.block.ParamBlockTaglet -Taglets.taglet.todo.dl.class= tagletsTodo -Taglets.taglet.todo.dl.header= <b>Todo:</b> diff --git a/src/test/java/com/healthmarketscience/jackcess/util/OleBlobTest.java b/src/test/java/com/healthmarketscience/jackcess/util/OleBlobTest.java index be3a0a9..725daa0 100644 --- a/src/test/java/com/healthmarketscience/jackcess/util/OleBlobTest.java +++ b/src/test/java/com/healthmarketscience/jackcess/util/OleBlobTest.java @@ -34,7 +34,7 @@ import com.healthmarketscience.jackcess.impl.CompoundOleUtil; import junit.framework.TestCase; import org.apache.poi.poifs.filesystem.DocumentEntry; import org.apache.poi.poifs.filesystem.DocumentInputStream; -import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; +import org.apache.poi.poifs.filesystem.POIFSFileSystem; import static com.healthmarketscience.jackcess.TestUtil.*; import static com.healthmarketscience.jackcess.impl.JetFormatTest.*; @@ -42,7 +42,7 @@ import static com.healthmarketscience.jackcess.impl.JetFormatTest.*; * * @author James Ahlborn */ -public class OleBlobTest extends TestCase +public class OleBlobTest extends TestCase { public OleBlobTest(String name) { @@ -73,7 +73,7 @@ public class OleBlobTest extends TestCase } finally { ByteUtil.closeQuietly(blob); } - + try { blob = new OleBlob.Builder() .setLink(sampleFile) @@ -82,7 +82,7 @@ public class OleBlobTest extends TestCase } finally { ByteUtil.closeQuietly(blob); } - + try { blob = new OleBlob.Builder() .setPackagePrettyName("Text File") @@ -109,14 +109,14 @@ public class OleBlobTest extends TestCase assertEquals(sampleFilePath, spc.getFilePath()); assertEquals(sampleFilePath, spc.getLocalFilePath()); assertEquals(sampleFileName, spc.getFileName()); - assertEquals(OleBlob.Builder.PACKAGE_PRETTY_NAME, + assertEquals(OleBlob.Builder.PACKAGE_PRETTY_NAME, spc.getPrettyName()); - assertEquals(OleBlob.Builder.PACKAGE_TYPE_NAME, + assertEquals(OleBlob.Builder.PACKAGE_TYPE_NAME, spc.getTypeName()); - assertEquals(OleBlob.Builder.PACKAGE_TYPE_NAME, + assertEquals(OleBlob.Builder.PACKAGE_TYPE_NAME, spc.getClassName()); assertEquals(sampleFileBytes.length, spc.length()); - assertTrue(Arrays.equals(sampleFileBytes, + assertTrue(Arrays.equals(sampleFileBytes, toByteArray(spc.getStream(), spc.length()))); break; @@ -130,7 +130,7 @@ public class OleBlobTest extends TestCase assertEquals(OleBlob.Builder.PACKAGE_TYPE_NAME, lc.getTypeName()); assertEquals(OleBlob.Builder.PACKAGE_TYPE_NAME, lc.getClassName()); break; - + case 3: OleBlob.OtherContent oc = (OleBlob.OtherContent)content; assertEquals(OleBlob.ContentType.OTHER, oc.getType()); @@ -138,7 +138,7 @@ public class OleBlobTest extends TestCase assertEquals("Text.File", oc.getClassName()); assertEquals("TextFile", oc.getTypeName()); assertEquals(sampleFileBytes.length, oc.length()); - assertTrue(Arrays.equals(sampleFileBytes, + assertTrue(Arrays.equals(sampleFileBytes, toByteArray(oc.getStream(), oc.length()))); break; default: @@ -149,8 +149,8 @@ public class OleBlobTest extends TestCase } } - db.close(); - } + db.close(); + } } public void testReadBlob() throws Exception @@ -198,7 +198,7 @@ public class OleBlobTest extends TestCase } else { if("test_word.doc".equals(name)) { - checkCompoundEntries(cc, + checkCompoundEntries(cc, "/%02OlePres000", 466, "/WordDocument", 4096, "/%05SummaryInformation", 4096, @@ -210,7 +210,7 @@ public class OleBlobTest extends TestCase "/%01Ole", 20); checkCompoundStorage(cc, attach); } else if("test_excel.xls".equals(name)) { - checkCompoundEntries(cc, + checkCompoundEntries(cc, "/%02OlePres000", 1326, "/%03AccessObjSiteData", 56, "/%05SummaryInformation", 200, @@ -243,10 +243,10 @@ public class OleBlobTest extends TestCase } db.close(); - } + } } - private static void checkCompoundEntries(OleBlob.CompoundContent cc, + private static void checkCompoundEntries(OleBlob.CompoundContent cc, Object... entryInfo) throws Exception { @@ -262,7 +262,7 @@ public class OleBlobTest extends TestCase } } - private static void checkCompoundStorage(OleBlob.CompoundContent cc, + private static void checkCompoundStorage(OleBlob.CompoundContent cc, Attachment attach) throws Exception { @@ -273,7 +273,7 @@ public class OleBlobTest extends TestCase fout.write(attach.getFileData()); fout.close(); - NPOIFSFileSystem attachFs = new NPOIFSFileSystem(tmpData, true); + POIFSFileSystem attachFs = new POIFSFileSystem(tmpData, true); for(OleBlob.CompoundContent.Entry e : cc) { DocumentEntry attachE = null; @@ -284,7 +284,7 @@ public class OleBlobTest extends TestCase continue; } - byte[] attachEBytes = toByteArray(new DocumentInputStream(attachE), + byte[] attachEBytes = toByteArray(new DocumentInputStream(attachE), attachE.getSize()); byte[] entryBytes = toByteArray(e.getStream(), e.length()); @@ -292,9 +292,9 @@ public class OleBlobTest extends TestCase } ByteUtil.closeQuietly(attachFs); - + } finally { tmpData.delete(); - } + } } } |