本文整理匯總了Java中org.apache.commons.io.output.NullOutputStream.write方法的典型用法代碼示例。如果您正苦於以下問題:Java NullOutputStream.write方法的具體用法?Java NullOutputStream.write怎麽用?Java NullOutputStream.write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.io.output.NullOutputStream
的用法示例。
在下文中一共展示了NullOutputStream.write方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loopAllEntitiesAndProperties
import org.apache.commons.io.output.NullOutputStream; //導入方法依賴的package包/類
public void loopAllEntitiesAndProperties() throws IOException {
NullOutputStream nullOutputStream = new NullOutputStream();
List<Person> listOfPersons = Service.getListOfPersons(100 * 1000);
long currentTimeMillis = System.currentTimeMillis();
ListContainer<Person> listContainer = new ListContainer<>(
listOfPersons);
Collection<?> ids = listContainer.getContainerPropertyIds();
for (int i = 0; i < listContainer.size(); i++) {
Item item = listContainer.getItem(listOfPersons.get(i));
for (Object propertyId : ids) {
Property itemProperty = item.getItemProperty(propertyId);
final Object value = itemProperty.getValue();
nullOutputStream.write(value.toString().getBytes());
LOG.log(Level.FINEST, "Property: %s", value);
}
}
LOG.
log(Level.INFO,
"Looping all properties in 100 000 Items took {0}ms",
(System.currentTimeMillis() - currentTimeMillis));
}
示例2: loopAllEntitiesAndPropertiesWithBeanItemContainer
import org.apache.commons.io.output.NullOutputStream; //導入方法依賴的package包/類
public void loopAllEntitiesAndPropertiesWithBeanItemContainer() throws IOException {
NullOutputStream nullOutputStream = new NullOutputStream();
List<Person> listOfPersons = Service.getListOfPersons(100 * 1000);
long currentTimeMillis = System.currentTimeMillis();
BeanItemContainer<Person> c = new BeanItemContainer<>(
Person.class, listOfPersons);
Collection<?> ids = c.getContainerPropertyIds();
for (int i = 0; i < c.size(); i++) {
Item item = c.getItem(listOfPersons.get(i));
for (Object propertyId : ids) {
Property itemProperty = item.getItemProperty(propertyId);
final Object value = itemProperty.getValue();
nullOutputStream.write(value.toString().getBytes());
LOG.log(Level.FINEST, "Property: %s", value);
}
}
// ~ 350ms in 1.34, MacBook Pro (Retina, Mid 2012) 2.3Gz i7
// ~ + 3-10ms in 1.35, when changing ListContainer to use PropertyUtils instead of WrapDynaBean
LOG.
log(Level.INFO,
"BIC from core: Looping all properties in 100 000 Items took {0}ms",
(System.currentTimeMillis() - currentTimeMillis));
}