com.googlecode.paradox.metadata.ParadoxTable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of paradoxdriver Show documentation
Show all versions of paradoxdriver Show documentation
A Paradox Java Driver (using JDBC 4)
/*
* ParadoxTable.java 03/12/2009 Copyright (C) 2009 Leonardo Alves da Costa This program is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a
* copy of the GNU General Public License along with this program. If not, see .
*/
package com.googlecode.paradox.metadata;
import com.googlecode.paradox.ParadoxConnection;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Stores a table data file.
*
* @author Leonardo Alves da Costa
* @version 1.2
* @since 1.0
*/
public final class ParadoxTable extends ParadoxDataFile {
/**
* The blob instance used to read the file.
*/
private BlobTable blobFile;
/**
* Encrypted data.
*/
private int encryptedData;
/**
* Creates a new instance.
*
* @param file table references file.
* @param name table name.
* @param connection the database connection.
*/
public ParadoxTable(final File file, final String name, final ParadoxConnection connection) {
super(file, name, connection);
}
/**
* Gets the blob table.
*
* @return the blob table.
*/
public BlobTable getBlobTable() {
if (this.blobFile == null) {
this.blobFile = new BlobTable(this.getFile(), this.getName(), getConnection());
}
return this.blobFile;
}
/**
* Return the block size in bytes.
*
* @return the block size in bytes.
*/
public int getBlockSizeBytes() {
// The blockSize is always in KiB.
return this.getBlockSize() * 1_024;
}
/**
* Gets the table name.
*
* @return the table name.
*/
@Override
public String toString() {
return this.getName();
}
/**
* Gets the primary keys list.
*
* @return the primary keys list.
*/
List getPrimaryKeys() {
final ArrayList ret = new ArrayList<>();
for (int loop = 0; loop < this.getPrimaryFieldCount(); loop++) {
ret.add(this.getFields().get(loop));
}
return ret;
}
public boolean isEncrypted() {
return encryptedData != 0;
}
public int getEncryptedData() {
return encryptedData;
}
public void setEncryptedData(int encryptedData) {
this.encryptedData = encryptedData;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy