當前位置: 首頁>>代碼示例>>Java>>正文


Java WritableFactories類代碼示例

本文整理匯總了Java中org.apache.hadoop.io.WritableFactories的典型用法代碼示例。如果您正苦於以下問題:Java WritableFactories類的具體用法?Java WritableFactories怎麽用?Java WritableFactories使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WritableFactories類屬於org.apache.hadoop.io包,在下文中一共展示了WritableFactories類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readObject

import org.apache.hadoop.io.WritableFactories; //導入依賴的package包/類
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
	// read the parent fields and the final fields
	in.defaultReadObject();

	// the job conf knows how to deserialize itself
	jobConf = new JobConf();
	jobConf.readFields(in);

	try {
		hadoopInputSplit = (org.apache.hadoop.mapred.InputSplit) WritableFactories.newInstance(splitType);
	}
	catch (Exception e) {
		throw new RuntimeException("Unable to instantiate Hadoop InputSplit", e);
	}

	if (hadoopInputSplit instanceof Configurable) {
		((Configurable) hadoopInputSplit).setConf(this.jobConf);
	}
	else if (hadoopInputSplit instanceof JobConfigurable) {
		((JobConfigurable) hadoopInputSplit).configure(this.jobConf);
	}
	hadoopInputSplit.readFields(in);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:24,代碼來源:HadoopInputSplit.java

示例2: read

import org.apache.hadoop.io.WritableFactories; //導入依賴的package包/類
@Override
public void read(DataInputView in) throws IOException {
	this.splitNumber=in.readInt();
	this.hadoopInputSplitTypeName = in.readUTF();
	if(hadoopInputSplit == null) {
		try {
			Class<? extends org.apache.hadoop.io.Writable> inputSplit =
					Class.forName(hadoopInputSplitTypeName).asSubclass(org.apache.hadoop.io.Writable.class);
			this.hadoopInputSplit = (org.apache.hadoop.mapred.InputSplit) WritableFactories.newInstance( inputSplit );
		}
		catch (Exception e) {
			throw new RuntimeException("Unable to create InputSplit", e);
		}
	}
	jobConf = new JobConf();
	jobConf.readFields(in);
	if (this.hadoopInputSplit instanceof Configurable) {
		((Configurable) this.hadoopInputSplit).setConf(this.jobConf);
	}
	this.hadoopInputSplit.readFields(in);

}
 
開發者ID:citlab,項目名稱:vs.msc.ws14,代碼行數:23,代碼來源:HadoopInputSplit.java

示例3: read

import org.apache.hadoop.io.WritableFactories; //導入依賴的package包/類
@Override
public void read(DataInputView in) throws IOException {
	this.splitNumber=in.readInt();
	String className = in.readUTF();
	
	if(this.mapreduceInputSplit == null) {
		try {
			Class<? extends org.apache.hadoop.io.Writable> inputSplit = 
					Class.forName(className).asSubclass(org.apache.hadoop.io.Writable.class);
			this.mapreduceInputSplit = (org.apache.hadoop.mapreduce.InputSplit) WritableFactories.newInstance(inputSplit);
		} catch (Exception e) {
			throw new RuntimeException("Unable to create InputSplit", e);
		}
	}
	((Writable)this.mapreduceInputSplit).readFields(in);
}
 
開發者ID:citlab,項目名稱:vs.msc.ws14,代碼行數:17,代碼來源:HadoopInputSplit.java

示例4: readObject

import org.apache.hadoop.io.WritableFactories; //導入依賴的package包/類
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
	// read the parent fields and the final fields
	in.defaultReadObject();

	try {
		Class<? extends Writable> writableSplit = splitType.asSubclass(Writable.class);
		mapreduceInputSplit = (org.apache.hadoop.mapreduce.InputSplit) WritableFactories.newInstance(writableSplit);
	}

	catch (Exception e) {
		throw new RuntimeException("Unable to instantiate the Hadoop InputSplit", e);
	}

	((Writable) mapreduceInputSplit).readFields(in);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:16,代碼來源:HadoopInputSplit.java

示例5: createWritableForName

import org.apache.hadoop.io.WritableFactories; //導入依賴的package包/類
/**
 * Used to dynamically load a filter class, and create a Writable filter.
 * This filter class most likely extends Configurable.
 *
 * @param className the filter class name.
 * @return a filter
 */
public static Filter createWritableForName(String className) {
  try {
    Class<? extends Filter> clazz = getFilterClassByName(className);
    return (Filter)WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}
 
開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:16,代碼來源:Classes.java

示例6: createForName

import org.apache.hadoop.io.WritableFactories; //導入依賴的package包/類
@SuppressWarnings("unchecked")
private Writable createForName(String className) {
	try {
		Class<? extends Writable> clazz = (Class<? extends Writable>) Class
				.forName(className);
		return WritableFactories.newInstance(clazz, new Configuration());
	} catch (ClassNotFoundException e) {
		throw new RuntimeException("Can't find class " + className);
	}
}
 
開發者ID:lifeng5042,項目名稱:RStore,代碼行數:11,代碼來源:Scan.java

示例7: createForName

import org.apache.hadoop.io.WritableFactories; //導入依賴的package包/類
@SuppressWarnings("unchecked")
private Writable createForName(String className) {
  try {
    Class<? extends Writable> clazz =
      (Class<? extends Writable>) Class.forName(className);
    return WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}
 
開發者ID:lifeng5042,項目名稱:RStore,代碼行數:11,代碼來源:Get.java

示例8: createForName

import org.apache.hadoop.io.WritableFactories; //導入依賴的package包/類
@SuppressWarnings("unchecked")
private Writable createForName(String className) {
  try {
    Class<? extends Writable> clazz = (Class<? extends Writable>) Class.forName(className);
    return WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}
 
開發者ID:intel-hadoop,項目名稱:CSBT,代碼行數:10,代碼來源:ClusterLocatorRPCObject.java

示例9: createWritableForName

import org.apache.hadoop.io.WritableFactories; //導入依賴的package包/類
/**
 * Used to dynamically load a filter class, and create a Writable filter.
 * This filter class most likely extends Configurable.
 *
 * @param className the filter class name.
 * @return a filter
 */
@SuppressWarnings("unchecked")
public static Filter createWritableForName(String className) {
  try {
    Class<? extends Filter> clazz =
      (Class<? extends Filter>) Class.forName(className, true, CLASS_LOADER);
    return (Filter)WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}
 
開發者ID:zwqjsj0404,項目名稱:HBase-Research,代碼行數:18,代碼來源:Classes.java


注:本文中的org.apache.hadoop.io.WritableFactories類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。