Remove more deprecated code
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1813102 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
af2813634b
commit
95828710f1
@ -114,26 +114,6 @@ public final class HSSFRow implements Row, Comparable<HSSFRow> {
|
|||||||
return this.createCell(column,CellType.BLANK);
|
return this.createCell(column,CellType.BLANK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this to create new cells within the row and return it.
|
|
||||||
* <p>
|
|
||||||
* The cell that is returned will be of the requested type.
|
|
||||||
* The type can be changed either through calling setCellValue
|
|
||||||
* or setCellType, but there is a small overhead to doing this,
|
|
||||||
* so it is best to create the required type up front.
|
|
||||||
*
|
|
||||||
* @param columnIndex - the column number this cell represents
|
|
||||||
*
|
|
||||||
* @return HSSFCell a high level representation of the created cell.
|
|
||||||
* @throws IllegalArgumentException if columnIndex < 0 or greater than 255,
|
|
||||||
* the maximum number of columns supported by the Excel binary format (.xls)
|
|
||||||
* @deprecated POI 3.15 beta 3
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public HSSFCell createCell(int columnIndex, int type)
|
|
||||||
{
|
|
||||||
return createCell(columnIndex, CellType.forInt(type));
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Use this to create new cells within the row and return it.
|
* Use this to create new cells within the row and return it.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -37,28 +37,6 @@ public interface Row extends Iterable<Cell> {
|
|||||||
*/
|
*/
|
||||||
Cell createCell(int column);
|
Cell createCell(int column);
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this to create new cells within the row and return it.
|
|
||||||
* <p>
|
|
||||||
* The cell that is returned will be of the requested type.
|
|
||||||
* The type can be changed either through calling setCellValue
|
|
||||||
* or setCellType, but there is a small overhead to doing this,
|
|
||||||
* so it is best to create of the required type up front.
|
|
||||||
*
|
|
||||||
* @param column - the column number this cell represents
|
|
||||||
* @param type - the cell's data type
|
|
||||||
* @return Cell a high level representation of the created cell.
|
|
||||||
* @throws IllegalArgumentException if columnIndex < 0 or greater than a maximum number of supported columns
|
|
||||||
* (255 for *.xls, 1048576 for *.xlsx)
|
|
||||||
* @see CellType#BLANK
|
|
||||||
* @see CellType#BOOLEAN
|
|
||||||
* @see CellType#ERROR
|
|
||||||
* @see CellType#FORMULA
|
|
||||||
* @see CellType#NUMERIC
|
|
||||||
* @see CellType#STRING
|
|
||||||
* @deprecated POI 3.15 beta 3. Use {@link #createCell(int, CellType)} instead.
|
|
||||||
*/
|
|
||||||
Cell createCell(int column, int type);
|
|
||||||
/**
|
/**
|
||||||
* Use this to create new cells within the row and return it.
|
* Use this to create new cells within the row and return it.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -122,23 +122,6 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
|
|||||||
return createCell(column, CellType.BLANK);
|
return createCell(column, CellType.BLANK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this to create new cells within the row and return it.
|
|
||||||
* <p>
|
|
||||||
* The cell that is returned is a {@link CellType#BLANK}. The type can be changed
|
|
||||||
* either through calling setCellValue or setCellType.
|
|
||||||
*
|
|
||||||
* @param column - the column number this cell represents
|
|
||||||
* @return Cell a high level representation of the created cell.
|
|
||||||
* @throws IllegalArgumentException if columnIndex < 0 or greate than a maximum number of supported columns
|
|
||||||
* (255 for *.xls, 1048576 for *.xlsx)
|
|
||||||
* @deprecated POI 3.15 beta 3. Use {@link #createCell(int, CellType)} instead.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SXSSFCell createCell(int column, int type)
|
|
||||||
{
|
|
||||||
return createCell(column, CellType.forInt(type));
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Use this to create new cells within the row and return it.
|
* Use this to create new cells within the row and return it.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -198,26 +198,6 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
|
|||||||
return createCell(columnIndex, CellType.BLANK);
|
return createCell(columnIndex, CellType.BLANK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this to create new cells within the row and return it.
|
|
||||||
*
|
|
||||||
* @param columnIndex - the column number this cell represents
|
|
||||||
* @param type - the cell's data type
|
|
||||||
* @return XSSFCell a high level representation of the created cell.
|
|
||||||
* @throws IllegalArgumentException if the specified cell type is invalid, columnIndex < 0
|
|
||||||
* or greater than 16384, the maximum number of columns supported by the SpreadsheetML format (.xlsx)
|
|
||||||
* @see CellType#BLANK
|
|
||||||
* @see CellType#BOOLEAN
|
|
||||||
* @see CellType#ERROR
|
|
||||||
* @see CellType#FORMULA
|
|
||||||
* @see CellType#NUMERIC
|
|
||||||
* @see CellType#STRING
|
|
||||||
* @deprecated POI 3.15 beta 3. Use {@link #createCell(int, CellType)} instead.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public XSSFCell createCell(int columnIndex, int type) {
|
|
||||||
return createCell(columnIndex, CellType.forInt(type));
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Use this to create new cells within the row and return it.
|
* Use this to create new cells within the row and return it.
|
||||||
*
|
*
|
||||||
|
@ -24,8 +24,7 @@ import org.apache.poi.util.Internal;
|
|||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
public final class SprmBuffer implements Cloneable
|
public final class SprmBuffer implements Cloneable {
|
||||||
{
|
|
||||||
|
|
||||||
//arbitrarily selected; may need to increase
|
//arbitrarily selected; may need to increase
|
||||||
private static final int MAX_RECORD_LENGTH = 100_000;
|
private static final int MAX_RECORD_LENGTH = 100_000;
|
||||||
@ -36,55 +35,24 @@ public final class SprmBuffer implements Cloneable
|
|||||||
|
|
||||||
private final int _sprmsStartOffset;
|
private final int _sprmsStartOffset;
|
||||||
|
|
||||||
/**
|
public SprmBuffer(byte[] buf, boolean istd, int sprmsStartOffset) {
|
||||||
* @deprecated Use {@link #SprmBuffer(int)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public SprmBuffer()
|
|
||||||
{
|
|
||||||
this( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #SprmBuffer(byte[],int)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public SprmBuffer( byte[] buf )
|
|
||||||
{
|
|
||||||
this( buf, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #SprmBuffer(byte[],boolean,int)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public SprmBuffer( byte[] buf, boolean istd )
|
|
||||||
{
|
|
||||||
this( buf, istd, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
public SprmBuffer( byte[] buf, boolean istd, int sprmsStartOffset )
|
|
||||||
{
|
|
||||||
_offset = buf.length;
|
_offset = buf.length;
|
||||||
_buf = buf;
|
_buf = buf;
|
||||||
_istd = istd;
|
_istd = istd;
|
||||||
_sprmsStartOffset = sprmsStartOffset;
|
_sprmsStartOffset = sprmsStartOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SprmBuffer( byte[] buf, int _sprmsStartOffset )
|
public SprmBuffer(byte[] buf, int _sprmsStartOffset) {
|
||||||
{
|
this(buf, false, _sprmsStartOffset);
|
||||||
this( buf, false, _sprmsStartOffset );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SprmBuffer( int sprmsStartOffset )
|
public SprmBuffer(int sprmsStartOffset) {
|
||||||
{
|
|
||||||
_buf = IOUtils.safelyAllocate(sprmsStartOffset + 4, MAX_RECORD_LENGTH);
|
_buf = IOUtils.safelyAllocate(sprmsStartOffset + 4, MAX_RECORD_LENGTH);
|
||||||
_offset = sprmsStartOffset;
|
_offset = sprmsStartOffset;
|
||||||
_sprmsStartOffset = sprmsStartOffset;
|
_sprmsStartOffset = sprmsStartOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSprm(short opcode, byte operand)
|
public void addSprm(short opcode, byte operand) {
|
||||||
{
|
|
||||||
int addition = LittleEndian.SHORT_SIZE + LittleEndian.BYTE_SIZE;
|
int addition = LittleEndian.SHORT_SIZE + LittleEndian.BYTE_SIZE;
|
||||||
ensureCapacity(addition);
|
ensureCapacity(addition);
|
||||||
LittleEndian.putShort(_buf, _offset, opcode);
|
LittleEndian.putShort(_buf, _offset, opcode);
|
||||||
@ -92,18 +60,16 @@ public final class SprmBuffer implements Cloneable
|
|||||||
_buf[_offset++] = operand;
|
_buf[_offset++] = operand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSprm(short opcode, byte[] operand)
|
public void addSprm(short opcode, byte[] operand) {
|
||||||
{
|
|
||||||
int addition = LittleEndian.SHORT_SIZE + LittleEndian.BYTE_SIZE + operand.length;
|
int addition = LittleEndian.SHORT_SIZE + LittleEndian.BYTE_SIZE + operand.length;
|
||||||
ensureCapacity(addition);
|
ensureCapacity(addition);
|
||||||
LittleEndian.putShort(_buf, _offset, opcode);
|
LittleEndian.putShort(_buf, _offset, opcode);
|
||||||
_offset += LittleEndian.SHORT_SIZE;
|
_offset += LittleEndian.SHORT_SIZE;
|
||||||
_buf[_offset++] = (byte)operand.length;
|
_buf[_offset++] = (byte) operand.length;
|
||||||
System.arraycopy(operand, 0, _buf, _offset, operand.length);
|
System.arraycopy(operand, 0, _buf, _offset, operand.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSprm(short opcode, int operand)
|
public void addSprm(short opcode, int operand) {
|
||||||
{
|
|
||||||
int addition = LittleEndian.SHORT_SIZE + LittleEndian.INT_SIZE;
|
int addition = LittleEndian.SHORT_SIZE + LittleEndian.INT_SIZE;
|
||||||
ensureCapacity(addition);
|
ensureCapacity(addition);
|
||||||
LittleEndian.putShort(_buf, _offset, opcode);
|
LittleEndian.putShort(_buf, _offset, opcode);
|
||||||
@ -112,8 +78,7 @@ public final class SprmBuffer implements Cloneable
|
|||||||
_offset += LittleEndian.INT_SIZE;
|
_offset += LittleEndian.INT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSprm(short opcode, short operand)
|
public void addSprm(short opcode, short operand) {
|
||||||
{
|
|
||||||
int addition = LittleEndian.SHORT_SIZE + LittleEndian.SHORT_SIZE;
|
int addition = LittleEndian.SHORT_SIZE + LittleEndian.SHORT_SIZE;
|
||||||
ensureCapacity(addition);
|
ensureCapacity(addition);
|
||||||
LittleEndian.putShort(_buf, _offset, opcode);
|
LittleEndian.putShort(_buf, _offset, opcode);
|
||||||
@ -122,21 +87,19 @@ public final class SprmBuffer implements Cloneable
|
|||||||
_offset += LittleEndian.SHORT_SIZE;
|
_offset += LittleEndian.SHORT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void append( byte[] grpprl )
|
public void append(byte[] grpprl) {
|
||||||
{
|
append(grpprl, 0);
|
||||||
append( grpprl, 0 );
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void append( byte[] grpprl, int offset )
|
public void append(byte[] grpprl, int offset) {
|
||||||
{
|
ensureCapacity(grpprl.length - offset);
|
||||||
ensureCapacity( grpprl.length - offset );
|
System.arraycopy(grpprl, offset, _buf, _offset, grpprl.length - offset);
|
||||||
System.arraycopy( grpprl, offset, _buf, _offset, grpprl.length - offset );
|
|
||||||
_offset += grpprl.length - offset;
|
_offset += grpprl.length - offset;
|
||||||
}
|
}
|
||||||
public SprmBuffer clone()
|
|
||||||
{
|
public SprmBuffer clone() {
|
||||||
try {
|
try {
|
||||||
SprmBuffer retVal = (SprmBuffer)super.clone();
|
SprmBuffer retVal = (SprmBuffer) super.clone();
|
||||||
retVal._buf = new byte[_buf.length];
|
retVal._buf = new byte[_buf.length];
|
||||||
System.arraycopy(_buf, 0, retVal._buf, 0, _buf.length);
|
System.arraycopy(_buf, 0, retVal._buf, 0, _buf.length);
|
||||||
return retVal;
|
return retVal;
|
||||||
@ -144,26 +107,24 @@ public final class SprmBuffer implements Cloneable
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ensureCapacity( int addition )
|
|
||||||
{
|
private void ensureCapacity(int addition) {
|
||||||
if ( _offset + addition >= _buf.length )
|
if (_offset + addition >= _buf.length) {
|
||||||
{
|
|
||||||
// add 6 more than they need for use the next iteration
|
// add 6 more than they need for use the next iteration
|
||||||
//
|
//
|
||||||
// commented - buffer shall not contain any additional bytes --
|
// commented - buffer shall not contain any additional bytes --
|
||||||
// sergey
|
// sergey
|
||||||
// byte[] newBuf = new byte[_offset + addition + 6];
|
// byte[] newBuf = new byte[_offset + addition + 6];
|
||||||
byte[] newBuf = IOUtils.safelyAllocate(_offset + addition, MAX_RECORD_LENGTH);
|
byte[] newBuf = IOUtils.safelyAllocate(_offset + addition, MAX_RECORD_LENGTH);
|
||||||
System.arraycopy( _buf, 0, newBuf, 0, _buf.length );
|
System.arraycopy(_buf, 0, newBuf, 0, _buf.length);
|
||||||
_buf = newBuf;
|
_buf = newBuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj) {
|
||||||
{
|
|
||||||
if (!(obj instanceof SprmBuffer)) return false;
|
if (!(obj instanceof SprmBuffer)) return false;
|
||||||
SprmBuffer sprmBuf = (SprmBuffer)obj;
|
SprmBuffer sprmBuf = (SprmBuffer) obj;
|
||||||
return (Arrays.equals(_buf, sprmBuf._buf));
|
return (Arrays.equals(_buf, sprmBuf._buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,78 +134,65 @@ public final class SprmBuffer implements Cloneable
|
|||||||
return 42; // any arbitrary constant will do
|
return 42; // any arbitrary constant will do
|
||||||
}
|
}
|
||||||
|
|
||||||
public SprmOperation findSprm( short opcode )
|
public SprmOperation findSprm(short opcode) {
|
||||||
{
|
int operation = SprmOperation.getOperationFromOpcode(opcode);
|
||||||
int operation = SprmOperation.getOperationFromOpcode( opcode );
|
int type = SprmOperation.getTypeFromOpcode(opcode);
|
||||||
int type = SprmOperation.getTypeFromOpcode( opcode );
|
|
||||||
|
|
||||||
SprmIterator si = new SprmIterator( _buf, 2 );
|
SprmIterator si = new SprmIterator(_buf, 2);
|
||||||
while ( si.hasNext() )
|
while (si.hasNext()) {
|
||||||
{
|
|
||||||
SprmOperation i = si.next();
|
SprmOperation i = si.next();
|
||||||
if ( i.getOperation() == operation && i.getType() == type )
|
if (i.getOperation() == operation && i.getType() == type)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int findSprmOffset( short opcode )
|
private int findSprmOffset(short opcode) {
|
||||||
{
|
SprmOperation sprmOperation = findSprm(opcode);
|
||||||
SprmOperation sprmOperation = findSprm( opcode );
|
if (sprmOperation == null)
|
||||||
if ( sprmOperation == null )
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return sprmOperation.getGrpprlOffset();
|
return sprmOperation.getGrpprlOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] toByteArray()
|
public byte[] toByteArray() {
|
||||||
{
|
|
||||||
return _buf;
|
return _buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SprmIterator iterator()
|
public SprmIterator iterator() {
|
||||||
{
|
return new SprmIterator(_buf, _sprmsStartOffset);
|
||||||
return new SprmIterator( _buf, _sprmsStartOffset );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSprm(short opcode, byte operand)
|
public void updateSprm(short opcode, byte operand) {
|
||||||
{
|
|
||||||
int grpprlOffset = findSprmOffset(opcode);
|
int grpprlOffset = findSprmOffset(opcode);
|
||||||
if(grpprlOffset != -1)
|
if (grpprlOffset != -1) {
|
||||||
{
|
|
||||||
_buf[grpprlOffset] = operand;
|
_buf[grpprlOffset] = operand;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addSprm(opcode, operand);
|
addSprm(opcode, operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSprm( short opcode, boolean operand )
|
public void updateSprm(short opcode, boolean operand) {
|
||||||
{
|
int grpprlOffset = findSprmOffset(opcode);
|
||||||
int grpprlOffset = findSprmOffset( opcode );
|
if (grpprlOffset != -1) {
|
||||||
if ( grpprlOffset != -1 )
|
_buf[grpprlOffset] = (byte) (operand ? 1 : 0);
|
||||||
{
|
|
||||||
_buf[grpprlOffset] = (byte) ( operand ? 1 : 0 );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addSprm( opcode, operand ? 1 : 0 );
|
addSprm(opcode, operand ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSprm(short opcode, int operand)
|
public void updateSprm(short opcode, int operand) {
|
||||||
{
|
|
||||||
int grpprlOffset = findSprmOffset(opcode);
|
int grpprlOffset = findSprmOffset(opcode);
|
||||||
if(grpprlOffset != -1)
|
if (grpprlOffset != -1) {
|
||||||
{
|
|
||||||
LittleEndian.putInt(_buf, grpprlOffset, operand);
|
LittleEndian.putInt(_buf, grpprlOffset, operand);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addSprm(opcode, operand);
|
addSprm(opcode, operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSprm(short opcode, short operand)
|
public void updateSprm(short opcode, short operand) {
|
||||||
{
|
|
||||||
int grpprlOffset = findSprmOffset(opcode);
|
int grpprlOffset = findSprmOffset(opcode);
|
||||||
if(grpprlOffset != -1)
|
if (grpprlOffset != -1) {
|
||||||
{
|
|
||||||
LittleEndian.putShort(_buf, grpprlOffset, operand);
|
LittleEndian.putShort(_buf, grpprlOffset, operand);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -252,23 +200,18 @@ public final class SprmBuffer implements Cloneable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
stringBuilder.append( "Sprms (" );
|
stringBuilder.append("Sprms (");
|
||||||
stringBuilder.append( _buf.length );
|
stringBuilder.append(_buf.length);
|
||||||
stringBuilder.append( " byte(s)): " );
|
stringBuilder.append(" byte(s)): ");
|
||||||
for ( SprmIterator iterator = iterator(); iterator.hasNext(); )
|
for (SprmIterator iterator = iterator(); iterator.hasNext(); ) {
|
||||||
{
|
try {
|
||||||
try
|
stringBuilder.append(iterator.next());
|
||||||
{
|
} catch (Exception exc) {
|
||||||
stringBuilder.append( iterator.next() );
|
stringBuilder.append("error");
|
||||||
}
|
}
|
||||||
catch ( Exception exc )
|
stringBuilder.append("; ");
|
||||||
{
|
|
||||||
stringBuilder.append( "error" );
|
|
||||||
}
|
|
||||||
stringBuilder.append( "; " );
|
|
||||||
}
|
}
|
||||||
return stringBuilder.toString();
|
return stringBuilder.toString();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user