本文整理汇总了Java中org.apache.hadoop.util.ReflectionUtils.copy方法的典型用法代码示例。如果您正苦于以下问题:Java ReflectionUtils.copy方法的具体用法?Java ReflectionUtils.copy怎么用?Java ReflectionUtils.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.util.ReflectionUtils
的用法示例。
在下文中一共展示了ReflectionUtils.copy方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clone
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
/**
* Make a copy of a writable object using serialization to a buffer.
* @param orig The object to copy
* @return The copied object
*/
public static <T extends Writable> T clone(T orig, Configuration conf) {
try {
@SuppressWarnings("unchecked") // Unchecked cast from Class to Class<T>
T newInst = ReflectionUtils.newInstance((Class<T>) orig.getClass(), conf);
ReflectionUtils.copy(conf, orig, newInst);
return newInst;
} catch (IOException e) {
throw new RuntimeException("Error writing/reading clone buffer", e);
}
}
示例2: nextKeyValue
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
synchronized (outer) {
if (!outer.nextKeyValue()) {
return false;
}
key = ReflectionUtils.copy(outer.getConfiguration(),
outer.getCurrentKey(), key);
value = ReflectionUtils.copy(conf, outer.getCurrentValue(), value);
return true;
}
}
示例3: nextKeyValue
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
public boolean nextKeyValue() throws IOException, InterruptedException {
if (key == null) {
key = createKey();
}
if (value == null) {
value = createValue();
}
if (jc.flush(ivalue)) {
ReflectionUtils.copy(conf, jc.key(), key);
ReflectionUtils.copy(conf, emit(ivalue), value);
return true;
}
if (ivalue == null) {
ivalue = createTupleWritable();
}
jc.clear();
final PriorityQueue<ComposableRecordReader<K,?>> q =
getRecordReaderQueue();
K iterkey = createKey();
while (q != null && !q.isEmpty()) {
fillJoinCollector(iterkey);
jc.reset(iterkey);
if (jc.flush(ivalue)) {
ReflectionUtils.copy(conf, jc.key(), key);
ReflectionUtils.copy(conf, emit(ivalue), value);
return true;
}
jc.clear();
}
return false;
}
示例4: next
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
public boolean next(V val) throws IOException {
boolean ret;
if (ret = jc.flush(ivalue)) {
ReflectionUtils.copy(getConf(), emit(ivalue), val);
}
return ret;
}
示例5: nextKeyValue
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
/**
* Emit the next set of key, value pairs as defined by the child
* RecordReaders and operation associated with this composite RR.
*/
public boolean nextKeyValue()
throws IOException, InterruptedException {
if (key == null) {
key = createKey();
}
if (jc.flush(value)) {
ReflectionUtils.copy(conf, jc.key(), key);
return true;
}
jc.clear();
if (value == null) {
value = createValue();
}
final PriorityQueue<ComposableRecordReader<K,?>> q =
getRecordReaderQueue();
K iterkey = createKey();
while (q != null && !q.isEmpty()) {
fillJoinCollector(iterkey);
jc.reset(iterkey);
if (jc.flush(value)) {
ReflectionUtils.copy(conf, jc.key(), key);
return true;
}
jc.clear();
}
return false;
}
示例6: next
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
public boolean next(X val) throws IOException {
if (iter.hasNext()) {
ReflectionUtils.copy(conf, iter.next(), val);
if (null == hold) {
hold = WritableUtils.clone(val, null);
} else {
ReflectionUtils.copy(conf, val, hold);
}
return true;
}
return false;
}
示例7: readFromQueue
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private boolean readFromQueue() throws IOException, InterruptedException {
KeyValuePair<KEYIN, VALUEIN> kv = null;
// wait for input on queue
kv = inputQueue.dequeue();
if (kv.endOfInput) {
return false;
}
key = (KEYIN) ReflectionUtils.newInstance(keyClass, conf);
value = (VALUEIN) ReflectionUtils.newInstance(valueClass, conf);
ReflectionUtils.copy(conf, kv.key, this.key);
ReflectionUtils.copy(conf, kv.value, this.value);
return true;
}
示例8: writeToQueue
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void writeToQueue(KEYOUT key, VALUEOUT value) throws IOException,
InterruptedException {
this.keyout = (KEYOUT) ReflectionUtils.newInstance(keyClass, conf);
this.valueout = (VALUEOUT) ReflectionUtils.newInstance(valueClass, conf);
ReflectionUtils.copy(conf, key, this.keyout);
ReflectionUtils.copy(conf, value, this.valueout);
// wait to write output to queuue
outputQueue.enqueue(new KeyValuePair<KEYOUT, VALUEOUT>(keyout, valueout));
}
示例9: nextKeyValue
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
synchronized (outer) {
if (!outer.nextKeyValue()) {
return false;
}
key = ReflectionUtils.copy(outer.getConfiguration(),
outer.getCurrentKey(), key);
value = ReflectionUtils.copy(conf, outer.getCurrentValue(), value);
return true;
}
}
示例10: testLengthIsSerialized
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
/**
* Length of region need to be properly serialized.
* */
@Test
public void testLengthIsSerialized() throws Exception {
TableSplit split1 = new TableSplit(TableName.valueOf("table"),
"row-start".getBytes(),
"row-end".getBytes(), "location", 666);
TableSplit deserialized = new TableSplit(TableName.valueOf("table"),
"row-start2".getBytes(),
"row-end2".getBytes(), "location1");
ReflectionUtils.copy(new Configuration(), split1, deserialized);
Assert.assertEquals(666, deserialized.getLength());
}
示例11: replay
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
public boolean replay(V val) throws IOException {
ReflectionUtils.copy(getConf(), emit(ivalue), val);
return true;
}
示例12: replay
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
public boolean replay(X val) throws IOException {
ReflectionUtils.copy(conf, hold, val);
return true;
}
示例13: key
import org.apache.hadoop.util.ReflectionUtils; //导入方法依赖的package包/类
/**
* Clone the key at the head of this RR into the object supplied.
*/
public void key(K qkey) throws IOException {
ReflectionUtils.copy(conf, key, qkey);
}