本文整理了Java中java.lang.reflect.Array.getByte()
方法的一些代码示例,展示了Array.getByte()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Array.getByte()
方法的具体详情如下:
包路径:java.lang.reflect.Array
类名称:Array
方法名:getByte
[英]Returns the byte at the given index in the given byte array.
[中]返回给定字节数组中给定索引处的字节。
代码示例来源:origin: redisson/redisson
@Override
protected String toString(Object array, int index) {
return ForNonArrayType.BYTE.toString(Array.getByte(array, index));
}
},
代码示例来源:origin: redisson/redisson
protected String arrayToString(Object o) {
int len = Array.getLength(o);
Class c = o.getClass().getComponentType();
String res = "[ ";
for (int i = 0; i < len; i++) {
if ( c == byte.class ) res+=Array.getByte(o,i);
if ( c == boolean.class ) res+=Array.getBoolean(o, i);
if ( c == char.class ) res+=Array.getChar(o, i);
if ( c == short.class ) res+=Array.getShort(o, i);
if ( c == int.class ) res+=Array.getInt(o, i);
if ( c == long.class ) res+=Array.getLong(o, i);
if ( c == float.class ) res+=Array.getFloat(o, i);
if ( c == double.class ) res+=Array.getDouble(o, i);
if ( i < len-1)
res+=",";
}
res += " ]";
return res;
}
代码示例来源:origin: drewnoakes/metadata-extractor
if (i != 0)
string.append(' ');
string.append(Array.getByte(o, i) & 0xff);
代码示例来源:origin: RuedigerMoeller/fast-serialization
protected String arrayToString(Object o) {
int len = Array.getLength(o);
Class c = o.getClass().getComponentType();
String res = "[ ";
for (int i = 0; i < len; i++) {
if ( c == byte.class ) res+=Array.getByte(o,i);
if ( c == boolean.class ) res+=Array.getBoolean(o, i);
if ( c == char.class ) res+=Array.getChar(o, i);
if ( c == short.class ) res+=Array.getShort(o, i);
if ( c == int.class ) res+=Array.getInt(o, i);
if ( c == long.class ) res+=Array.getLong(o, i);
if ( c == float.class ) res+=Array.getFloat(o, i);
if ( c == double.class ) res+=Array.getDouble(o, i);
if ( i < len-1)
res+=",";
}
res += " ]";
return res;
}
代码示例来源:origin: geotools/geotools
dest[i] = Array.getByte(array, i);
代码示例来源:origin: gdpancheng/LoonAndroid3
@Override
public Object get(Object array, int index) {
return Array.getByte(array, index);
}
代码示例来源:origin: gdpancheng/LoonAndroid3
@Override
public Object get(Object array, int index) {
return Array.getByte(array, index);
}
代码示例来源:origin: org.testifyproject.external/external-bytebuddy
@Override
protected String toString(Object array, int index) {
return ForNonArrayType.BYTE.toString(Array.getByte(array, index));
}
},
代码示例来源:origin: jtulach/bck2brwsr
/**
* Returns the value of the indexed component in the specified
* array object, as a {@code short}.
*
* @param array the array
* @param index the index
* @return the value of the indexed component in the specified array
* @exception NullPointerException If the specified object is null
* @exception IllegalArgumentException If the specified object is not
* an array, or if the indexed element cannot be converted to the
* return type by an identity or widening conversion
* @exception ArrayIndexOutOfBoundsException If the specified {@code index}
* argument is negative, or if it is greater than or equal to the
* length of the specified array
* @see Array#get
*/
public static short getShort(Object array, int index)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
final Class<?> t = array.getClass().getComponentType();
if (MethodImpl.samePrimitive(t, Short.TYPE)) {
short[] arr = (short[]) array;
return arr[index];
}
return getByte(array, index);
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul.mini
/**
* Returns the value of the indexed component in the specified
* array object, as a {@code short}.
*
* @param array the array
* @param index the index
* @return the value of the indexed component in the specified array
* @exception NullPointerException If the specified object is null
* @exception IllegalArgumentException If the specified object is not
* an array, or if the indexed element cannot be converted to the
* return type by an identity or widening conversion
* @exception ArrayIndexOutOfBoundsException If the specified {@code index}
* argument is negative, or if it is greater than or equal to the
* length of the specified array
* @see Array#get
*/
public static short getShort(Object array, int index)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
final Class<?> t = array.getClass().getComponentType();
if (MethodImpl.samePrimitive(t, Short.TYPE)) {
short[] arr = (short[]) array;
return arr[index];
}
return getByte(array, index);
}
代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket
/**
* @throws IOException
* @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object,
* WicketObjectOutputStream)
*/
public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException
{
int length = Array.getLength(object);
dos.writeInt(length);
for (int i = 0; i < length; i++)
{
dos.writeByte(Array.getByte(object, i));
}
}
代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service
/**
* @throws IOException
* @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object,
* WicketObjectOutputStream)
*/
@Override
public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException
{
int length = Array.getLength(object);
dos.writeInt(length);
for (int i = 0; i < length; i++)
{
dos.writeByte(Array.getByte(object, i));
}
}
代码示例来源:origin: org.kuali.rice/rice-core-api
public static Object toObject(Object value) {
if (!value.getClass().isArray())
return value;
Class type = value.getClass().getComponentType();
if (Array.getLength(value) == 0)
return null;
if (!type.isPrimitive())
return Array.get(value, 0);
if (boolean.class.isAssignableFrom(type))
return Array.getBoolean(value, 0);
if (char.class.isAssignableFrom(type))
return new Character(Array.getChar(value, 0));
if (byte.class.isAssignableFrom(type))
return new Byte(Array.getByte(value, 0));
if (int.class.isAssignableFrom(type))
return new Integer(Array.getInt(value, 0));
if (long.class.isAssignableFrom(type))
return new Long(Array.getLong(value, 0));
if (short.class.isAssignableFrom(type))
return new Short(Array.getShort(value, 0));
if (double.class.isAssignableFrom(type))
return new Double(Array.getDouble(value, 0));
if (float.class.isAssignableFrom(type))
return new Float(Array.getFloat(value, 0));
return null;
}
代码示例来源:origin: org.geotools/gt-coverage
dest[i] = Array.getByte(array, i);
代码示例来源:origin: us.ihmc/IHMCJavaToolkit
return (Array.getByte(instance1, index) == Array.getByte(instance2, index));
else if (type == short.class)
return (Array.getShort(instance1, index) == Array.getShort(instance2, index));
代码示例来源:origin: us.ihmc/ihmc-java-toolkit
return (Array.getByte(instance1, index) == Array.getByte(instance2, index));
else if (type == short.class)
return (Array.getShort(instance1, index) == Array.getShort(instance2, index));
代码示例来源:origin: julianhyde/linq4j
/**
* Gets an item from an array.
*/
public Object arrayItem(Object dataSet, int ordinal) {
// Plain old Array.get doesn't cut it when you have an array of
// Integer values but you want to read Short values. Array.getShort
// does the right thing.
switch (this) {
case DOUBLE:
return Array.getDouble(dataSet, ordinal);
case FLOAT:
return Array.getFloat(dataSet, ordinal);
case BOOLEAN:
return Array.getBoolean(dataSet, ordinal);
case BYTE:
return Array.getByte(dataSet, ordinal);
case CHAR:
return Array.getChar(dataSet, ordinal);
case SHORT:
return Array.getShort(dataSet, ordinal);
case INT:
return Array.getInt(dataSet, ordinal);
case LONG:
return Array.getLong(dataSet, ordinal);
case OTHER:
return Array.get(dataSet, ordinal);
default:
throw new AssertionError("unexpected " + this);
}
}
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/**
* Gets an item from an array.
*/
public Object arrayItem(Object dataSet, int ordinal) {
// Plain old Array.get doesn't cut it when you have an array of
// Integer values but you want to read Short values. Array.getShort
// does the right thing.
switch (this) {
case DOUBLE:
return Array.getDouble(dataSet, ordinal);
case FLOAT:
return Array.getFloat(dataSet, ordinal);
case BOOLEAN:
return Array.getBoolean(dataSet, ordinal);
case BYTE:
return Array.getByte(dataSet, ordinal);
case CHAR:
return Array.getChar(dataSet, ordinal);
case SHORT:
return Array.getShort(dataSet, ordinal);
case INT:
return Array.getInt(dataSet, ordinal);
case LONG:
return Array.getLong(dataSet, ordinal);
case OTHER:
return Array.get(dataSet, ordinal);
default:
throw new AssertionError("unexpected " + this);
}
}
代码示例来源:origin: com.jtransc/jtransc-rt
@JTranscSync
public static Object get(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
Type elementType = getArrayElementType(array.getClass());
if (elementType == Boolean.TYPE) return getBoolean(array, index);
if (elementType == Byte.TYPE) return getByte(array, index);
if (elementType == Character.TYPE) return getChar(array, index);
if (elementType == Short.TYPE) return getShort(array, index);
if (elementType == Integer.TYPE) return getInt(array, index);
if (elementType == Long.TYPE) return getLong(array, index);
if (elementType == Float.TYPE) return getFloat(array, index);
if (elementType == Double.TYPE) return getDouble(array, index);
return getInstance(array, index);
}
代码示例来源:origin: org.chromattic/chromattic.core
return (E)d;
} else if (componentType == byte.class) {
Byte b = Array.getByte(array, index);
return (E)b;
} else if (componentType == char.class) {
内容来源于网络,如有侵权,请联系作者删除!