mirror of https://github.com/apache/poi.git
ArrayUtil - remove unused method
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1876205 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
65ccec11cb
commit
3a6ebecc6f
|
@ -20,33 +20,11 @@ package org.apache.poi.util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility classes for dealing with arrays.
|
* Utility classes for dealing with arrays.
|
||||||
*
|
|
||||||
* @author Glen Stampoultzis
|
|
||||||
*/
|
*/
|
||||||
public class ArrayUtil
|
@Internal
|
||||||
{
|
public final class ArrayUtil {
|
||||||
/**
|
|
||||||
* This is really a debugging version of <code>System.arraycopy()</code>.
|
|
||||||
* Use it to provide better exception messages when copying arrays around.
|
|
||||||
* For production use it's better to use the original for speed.
|
|
||||||
*/
|
|
||||||
public static void arraycopy(byte[] src, int src_position, byte[] dst, int dst_position, int length)
|
|
||||||
{
|
|
||||||
if (src_position < 0)
|
|
||||||
throw new IllegalArgumentException("src_position was less than 0. Actual value " + src_position);
|
|
||||||
if (src_position >= src.length)
|
|
||||||
throw new IllegalArgumentException( "src_position was greater than src array size. Tried to write starting at position " + src_position + " but the array length is " + src.length );
|
|
||||||
if (src_position + length > src.length)
|
|
||||||
throw new IllegalArgumentException("src_position + length would overrun the src array. Expected end at " + (src_position + length) + " actual end at " + src.length);
|
|
||||||
if (dst_position < 0)
|
|
||||||
throw new IllegalArgumentException("dst_position was less than 0. Actual value " + dst_position);
|
|
||||||
if (dst_position >= dst.length)
|
|
||||||
throw new IllegalArgumentException( "dst_position was greater than dst array size. Tried to write starting at position " + dst_position + " but the array length is " + dst.length );
|
|
||||||
if (dst_position + length > dst.length)
|
|
||||||
throw new IllegalArgumentException("dst_position + length would overrun the dst array. Expected end at " + (dst_position + length) + " actual end at " + dst.length);
|
|
||||||
|
|
||||||
System.arraycopy( src, src_position, dst, dst_position, length);
|
private ArrayUtil() {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves a number of entries in an array to another point in the array,
|
* Moves a number of entries in an array to another point in the array,
|
||||||
|
|
|
@ -29,22 +29,6 @@ import org.junit.Test;
|
||||||
* Unit test for ArrayUtil
|
* Unit test for ArrayUtil
|
||||||
*/
|
*/
|
||||||
public class TestArrayUtil {
|
public class TestArrayUtil {
|
||||||
/**
|
|
||||||
* Test to ensure that our own arraycopy behaves as it should do
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testarraycopy() {
|
|
||||||
byte[] bytes = new byte[] { 0x01, 0x02, 0x03, 0x04 };
|
|
||||||
|
|
||||||
// Test copy whole thing
|
|
||||||
byte[] dest = new byte[4];
|
|
||||||
ArrayUtil.arraycopy(bytes, 0, dest, 0, 4);
|
|
||||||
|
|
||||||
assertArrayEquals(dest, bytes);
|
|
||||||
// ToDo - test exceptions are as expected
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper for testArrayMoveWithin
|
* Helper for testArrayMoveWithin
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue