本文整理汇总了Java中org.apache.flink.api.common.io.FileInputFormat.setFilesFilter方法的典型用法代码示例。如果您正苦于以下问题:Java FileInputFormat.setFilesFilter方法的具体用法?Java FileInputFormat.setFilesFilter怎么用?Java FileInputFormat.setFilesFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.api.common.io.FileInputFormat
的用法示例。
在下文中一共展示了FileInputFormat.setFilesFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readFile
import org.apache.flink.api.common.io.FileInputFormat; //导入方法依赖的package包/类
/**
* Reads the contents of the user-specified {@code filePath} based on the given {@link FileInputFormat}. Depending
* on the provided {@link FileProcessingMode}.
*
* <p>See {@link #readFile(FileInputFormat, String, FileProcessingMode, long)}
*
* @param inputFormat
* The input format used to create the data stream
* @param filePath
* The path of the file, as a URI (e.g., "file:///some/local/file" or "hdfs://host:port/file/path")
* @param watchType
* The mode in which the source should operate, i.e. monitor path and react to new data, or process once and exit
* @param interval
* In the case of periodic path monitoring, this specifies the interval (in millis) between consecutive path scans
* @param filter
* The files to be excluded from the processing
* @param <OUT>
* The type of the returned data stream
* @return The data stream that represents the data read from the given file
*
* @deprecated Use {@link FileInputFormat#setFilesFilter(FilePathFilter)} to set a filter and
* {@link StreamExecutionEnvironment#readFile(FileInputFormat, String, FileProcessingMode, long)}
*
*/
@PublicEvolving
@Deprecated
public <OUT> DataStreamSource<OUT> readFile(FileInputFormat<OUT> inputFormat,
String filePath,
FileProcessingMode watchType,
long interval,
FilePathFilter filter) {
inputFormat.setFilesFilter(filter);
TypeInformation<OUT> typeInformation;
try {
typeInformation = TypeExtractor.getInputFormatTypes(inputFormat);
} catch (Exception e) {
throw new InvalidProgramException("The type returned by the input format could not be " +
"automatically determined. Please specify the TypeInformation of the produced type " +
"explicitly by using the 'createInput(InputFormat, TypeInformation)' method instead.");
}
return readFile(inputFormat, filePath, watchType, interval, typeInformation);
}