Sequenceablepublic class SharedBlock extends Object implements Sequenceable
This class also provides methods for operating shared blocks, such as obtaining the index of a specified column and inserting data into a specified position.
SystemCapability.Data#DATA_APPDATAMGRSequenceable.Producer<T>| 构造器 | 说明 |
|---|---|
SharedBlock(String name) |
A constructor used to create a
SharedBlock instance with a given Parcel object. |
SharedBlock(Parcel source) |
A constructor used to create a
SharedBlock instance with a given Parcel object. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
allocateRow() |
Adds a new row at the end of a
SharedBlock. |
void |
clear() |
Clears data in a shared block.
|
void |
close() |
Release a reference of this object, closing this object if the last reference is released.
|
protected void |
finalize() |
Reclaims resources of this object.
|
void |
freeLastRow() |
Releases data in the last row of a
SharedBlock. |
byte[] |
getBlob(int rowIndex,
int columnIndex) |
Obtains the
byte array value at the position specified by rowIndex and columnIndex. |
double |
getDouble(int rowIndex,
int columnIndex) |
Obtains the
double value at the position specified by rowIndex and columnIndex. |
float |
getFloat(int rowIndex,
int columnIndex) |
Obtains the
float value at the position specified by rowIndex and columnIndex. |
int |
getInt(int rowIndex,
int columnIndex) |
Obtains the
int value at the position specified by rowIndex and columnIndex. |
long |
getLong(int rowIndex,
int columnIndex) |
Obtains the
long value at the position specified by rowIndex and columnIndex. |
String |
getName() |
Obtains the name of a shared block.
|
int |
getRowCount() |
Obtains the number of data rows in a
SharedBlock. |
short |
getShort(int rowIndex,
int columnIndex) |
Obtains the
short value at the position specified by rowIndex and columnIndex. |
int |
getStartRowIndex() |
Obtains the start row index from a shared block.
|
String |
getString(int rowIndex,
int columnIndex) |
Obtains the
string value at the position specified by rowIndex and columnIndex. |
ResultSet.ColumnType |
getType(int rowIndex,
int columnIndex) |
|
boolean |
marshalling(Parcel out) |
Marshals this
Sequenceable object into a Parcel. |
boolean |
putBlob(byte[] value,
int rowIndex,
int columnIndex) |
Assigns a
byte array value to a specified position in the SharedBlock. |
boolean |
putDouble(double value,
int rowIndex,
int columnIndex) |
Assigns a
double value to a specified position in the SharedBlock. |
boolean |
putLong(long value,
int rowIndex,
int columnIndex) |
Assigns a
long value to a specified position in the SharedBlock. |
boolean |
putNull(int rowIndex,
int columnIndex) |
Assigns
null to a specified position in the SharedBlock. |
boolean |
putString(String value,
int rowIndex,
int columnIndex) |
Assigns a
string value to a specified position in the SharedBlock. |
boolean |
setColumnCount(int count) |
Sets the number of data columns in a
SharedBlock. |
void |
setStartRowIndex(int rowIndex) |
Sets the start row index of a shared block to
rowIndex. |
boolean |
unmarshalling(Parcel in) |
Unmarshals this
Sequenceable object from a Parcel. |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasFileDescriptorpublic SharedBlock(String name)
SharedBlock instance with a given Parcel object.
If name is null, the default value unKnown will be used.
name - Indicates the name of the SharedBlock instance.public boolean allocateRow()
SharedBlock.true if the row is added successfully; returns false if the
shared block has insufficient space.public void freeLastRow()
SharedBlock.public ResultSet.ColumnType getType(int rowIndex, int columnIndex)
rowIndex - The zero-based row index.columnIndex - The zero-based column index.ColumnType of the value at the specified position.public String getName()
The name of the shared block will never be null.
public void clear()
After the data is cleared, new data can be allocated to the shared block.
public int getStartRowIndex()
0.public void setStartRowIndex(int rowIndex)
rowIndex.rowIndex - Indicates the specified row index, which starts from 0.public int getRowCount()
SharedBlock.public boolean setColumnCount(int count)
SharedBlock.count - Indicates the number of data columns.true if the number of data columns is set successfully; returns false otherwise.public byte[] getBlob(int rowIndex,
int columnIndex)
byte array value at the position specified by rowIndex and columnIndex.
The returned result varies depending on the value type.
ColumnType#TYPE_NULL, null is returned.
ColumnType#TYPE_BLOB, the value is returned directly.
ColumnType#TYPE_STRING, a byte array value converted from the string value
is returned.
ColumnType#TYPE_FLOAT or ColumnType#TYPE_INTEGER, an exception
is thrown.
rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.byte array value at the specified position.public String getString(int rowIndex, int columnIndex)
string value at the position specified by rowIndex and columnIndex.
The returned result varies depending on the value type.
ColumnType#TYPE_NULL, null is returned.
ColumnType#TYPE_STRING, the value is returned directly.
ColumnType#TYPE_FLOAT, a string of float data in decimal format is returned.
ColumnType#TYPE_INTEGER, a string of a decimal integer is returned.
ColumnType#TYPE_BLOB, an exception is thrown.
rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.string value at the specified position.public long getLong(int rowIndex,
int columnIndex)
long value at the position specified by rowIndex and columnIndex.
The returned result varies depending on the value type.
ColumnType#TYPE_NULL, 0L is returned.
ColumnType#TYPE_STRING, a long value converted from the string value
is returned.
ColumnType#TYPE_INTEGER, the value is returned directly.
ColumnType#TYPE_FLOAT, a long value converted from the float value is returned.
ColumnType#TYPE_BLOB, an exception is thrown.
rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.long value at the specified position.public double getDouble(int rowIndex,
int columnIndex)
double value at the position specified by rowIndex and columnIndex.
The returned result varies depending on the value type.
ColumnType#TYPE_NULL, 0.0 is returned.
ColumnType#TYPE_STRING, a double value converted from the string value
is returned.
ColumnType#TYPE_INTEGER, a double value converted from the integer value
is returned.
ColumnType#TYPE_FLOAT, the value is returned directly.
ColumnType#TYPE_BLOB, an exception is thrown.
rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.double value at the specified position.public short getShort(int rowIndex,
int columnIndex)
short value at the position specified by rowIndex and columnIndex.
You can call the getLong(int, int) method to convert the result into a short value.
rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.short value at the specified position.public int getInt(int rowIndex,
int columnIndex)
int value at the position specified by rowIndex and columnIndex.
You can call the getLong(int, int) method to convert the result into an int value.
rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.int value at the specified position.public float getFloat(int rowIndex,
int columnIndex)
float value at the position specified by rowIndex and columnIndex.
You can call the getDouble(int, int) method to convert the result into a float value.
rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.float value at the specified position.public boolean putBlob(byte[] value,
int rowIndex,
int columnIndex)
byte array value to a specified position in the SharedBlock.value - Indicates the value to assign.rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.true if the value is assigned; returns false otherwise.public boolean putString(String value, int rowIndex, int columnIndex)
string value to a specified position in the SharedBlock.value - Indicates the value to assign.rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.true if the value is assigned; returns false otherwise.public boolean putLong(long value,
int rowIndex,
int columnIndex)
long value to a specified position in the SharedBlock.value - Indicates the value to assign.rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.true if the value is assigned; returns false otherwise.public boolean putDouble(double value,
int rowIndex,
int columnIndex)
double value to a specified position in the SharedBlock.value - Indicates the value to assign.rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.true if the value is assigned; returns false otherwise.public boolean putNull(int rowIndex,
int columnIndex)
null to a specified position in the SharedBlock.rowIndex - Indicates the specified row index, which starts from 0.columnIndex - Indicates the specified column index, which starts from 0.true if the value is assigned; returns false otherwise.protected void finalize()
throws Throwable
finalize 在类中 ObjectThrowable - Throws this exception if an error occurs during the resource reclaiming.WeakReference,
PhantomReferencepublic boolean marshalling(Parcel out)
SequenceableSequenceable object into a Parcel.marshalling 在接口中 Sequenceableout - Indicates the Parcel object to which the Sequenceable
object will be marshaled..true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
SequenceableSequenceable object from a Parcel.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object into which the Sequenceable
object has been marshaled.true if the unmarshalling is successful; returns false otherwise.public void close()