当前位置: 首页>>代码示例>>Java>>正文


Java ArrayUtils.toObject方法代码示例

本文整理汇总了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);
}
 
开发者ID:jc0541,项目名称:URTorrent,代码行数:31,代码来源:BencodeReader.java

示例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);
    }

}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:27,代码来源:JtableUtils.java

示例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;

       }

}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:36,代码来源:AlosGeoTiff.java

示例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 {

	}

}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:35,代码来源:GDALAlosCeos.java

示例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 {

	}

}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:35,代码来源:BinaryAlosCeos.java

示例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);
}
 
开发者ID:nomemory,项目名称:java-bean-validation-extension,代码行数:5,代码来源:OneOfCharsValidator.java

示例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);
}
 
开发者ID:nomemory,项目名称:java-bean-validation-extension,代码行数:5,代码来源:OneOfDoublesValidator.java

示例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);
}
 
开发者ID:nomemory,项目名称:java-bean-validation-extension,代码行数:5,代码来源:OneOfIntegersValidator.java

示例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);
}
 
开发者ID:nomemory,项目名称:java-bean-validation-extension,代码行数:5,代码来源:OneOfLongsValidator.java


注:本文中的org.apache.commons.lang3.ArrayUtils.toObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。