本文整理汇总了Java中org.apache.commons.lang3.ArrayUtils.toObject方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtils.toObject方法的具体用法?Java ArrayUtils.toObject怎么用?Java ArrayUtils.toObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.ArrayUtils
的用法示例。
在下文中一共展示了ArrayUtils.toObject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readString
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
* Reads a bencoded <code>String</code> from the <code>InputStream</code>.
*
* @since 0.1.0
* @exception IOException if an IO exception occurs when reading
* @exception EOFException if the stream ended unexpectedly
* @exception BencodeReadException if the value read is not a properly bencoded String
*/
public Byte[] readString() throws IOException, BencodeReadException {
int len = readLen();
// now read until we have the entire thing
byte[] bs = new byte[len];
if (len == 0) { // edge case where last value is an empty string
return new Byte[0];
}
int off = input.read(bs);
if (off == -1) {
throw new EOFException();
}
while (off != len) {
int more = input.read(bs, off, len - off);
if (more == -1) {
throw new EOFException();
}
off += more;
}
return ArrayUtils.toObject(bs);
}
示例2: deletecols
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
* deletes all selected columns if it is not present in the <code>exp</code>
* List
*
* @param table the table to DELETE columns
* @param exp columns to avoid deleting
* @see #deletecol(javax.swing.JTable, int)
*/
static void deletecols(JTable table, int[] exp) {
Integer[] selcols;
try {
TableColumnModel tcm = table.getColumnModel();
selcols = ArrayUtils.toObject(table.getSelectedColumns());
Arrays.sort(selcols, Collections.reverseOrder());
List<Integer> explist = Ints.asList(exp);
for (int i : selcols) {
if (!explist.contains(i)) {
tcm.removeColumn(tcm.getColumn(i));
}
}
} catch (Exception e) {
Logger.getLogger(JtableUtils.class.getName()).log(Level.SEVERE, null, e);
}
}
示例3: preloadLineTile
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public void preloadLineTile(int y, int length, int band) {
if (y < 0) {
return;
}
preloadedInterval = new int[]{y, y + length};
Rectangle rect = new Rectangle(0, y, getImage(band).xSize, length);
TIFF tiff=getImage(band);
rect=tiff.getBounds().intersection(rect);
try {
BufferedImage bi=null;
try{
bi=tiff.read(0, rect);
}catch(Exception e){
logger.warn("Problem reading image POS x:"+0+ " y: "+y +" try to read again");
try {
Thread.sleep(100);
} catch(InterruptedException exx) {
Thread.currentThread().interrupt();
}
bi=tiff.read(0, rect);
}
WritableRaster raster=bi.getRaster();
short[]ss=(short[])raster.getDataElements(0, 0, raster.getWidth(), raster.getHeight(), null);//tSamples(0, 0, raster.getWidth(), raster.getHeight(), 0, (short[]) null);
preloadedData=ArrayUtils.toObject(ss);
} catch (Exception ex) {
logger.error(ex.getMessage(),ex);
}finally{
//tiff.reader.addIIOReadProgressListener(this);
//readComplete=false;
}
}
示例4: preloadLineTile
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public void preloadLineTile(int y, int length, int band) {
if (y < 0) {
return;
}
GeoToolsGDALReader tiff = (GeoToolsGDALReader)getImage(band);
preloadedInterval = new int[] { y, y + length };
Rectangle rect = new Rectangle(0, y, tiff.getxSize(), length);
rect = tiff.getBounds().intersection(rect);
try {
int[] bi = null;
try {
bi = tiff.readPixValues(0, y, rect.width, rect.height);
//bi = tiff.readShortValues(0, y, tiff.xSize, length);
} catch (Exception e) {
logger.warn("Problem reading image POS x:" + 0 + " y: " + y + " try to read again");
try {
Thread.sleep(100);
} catch (InterruptedException exx) {
Thread.currentThread().interrupt();
}
bi = tiff.readPixValues(0, y, rect.width, rect.height);
}
preloadedData =ArrayUtils.toObject(bi);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
} finally {
}
}
示例5: preloadLineTile
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public void preloadLineTile(int y, int length, int band) {
if (y < 0) {
return;
}
CeosBinaryReader tiff = (CeosBinaryReader)getImage(band);
preloadedInterval = new int[] { y, y + length };
Rectangle rect = new Rectangle(0, y, tiff.getxSize(), length);
rect = tiff.getBounds().intersection(rect);
try {
int[] bi = null;
try {
bi = tiff.readInt(0, y, rect.width, rect.height);
//bi = tiff.readShortValues(0, y, tiff.xSize, length);
} catch (Exception e) {
logger.warn("Problem reading image POS x:" + 0 + " y: " + y + " try to read again");
try {
Thread.sleep(100);
} catch (InterruptedException exx) {
Thread.currentThread().interrupt();
}
bi = tiff.readInt(0, y, rect.width, rect.height);
}
preloadedData = ArrayUtils.toObject(bi);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
} finally {
}
}
示例6: isValid
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public boolean isValid(Character value, ConstraintValidatorContext context) {
return super.isValid(value, ArrayUtils.toObject(annotation.value()), Objects::equals, context);
}
示例7: isValid
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public boolean isValid(Double value, ConstraintValidatorContext context) {
return super.isValid(value, ArrayUtils.toObject(annotation.value()), Objects::equals, context);
}
示例8: isValid
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public boolean isValid(Integer value, ConstraintValidatorContext context) {
return super.isValid(value, ArrayUtils.toObject(annotation.value()), Objects::equals, context);
}
示例9: isValid
import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public boolean isValid(Long value, ConstraintValidatorContext context) {
return super.isValid(value, ArrayUtils.toObject(annotation.value()), Objects::equals, context);
}