-
Notifications
You must be signed in to change notification settings - Fork 62
/
FileInputReader.java
61 lines (53 loc) · 1.9 KB
/
FileInputReader.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright (c) StreamThoughts
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.streamthoughts.kafka.connect.filepulse.reader;
import io.streamthoughts.kafka.connect.filepulse.data.TypedStruct;
import io.streamthoughts.kafka.connect.filepulse.source.FileObjectMeta;
import io.streamthoughts.kafka.connect.filepulse.source.FileRecord;
import java.net.URI;
import java.util.Map;
import org.apache.kafka.common.Configurable;
/**
* A {@code FileInputReader} is the principal class used to read an input file/object.
*/
public interface FileInputReader extends FileInputIteratorFactory, Configurable, AutoCloseable {
/**
* Configure this class with the given key-value pairs.
*
* @param configs the reader configuration.
*/
@Override
default void configure(final Map<String, ?> configs) {
}
/**
* Gets the metadata for the source object identified by the given {@link URI}.
*
* @param objectURI the {@link URI} of the file object.
* @return a new {@link FileObjectMeta} instance.
*/
FileObjectMeta getObjectMetadata(final URI objectURI);
/**
* Checks whether the source object identified by the given {@link URI} can be read.
*
* @param objectURI the {@link URI} of the file object.
* @return the {@code true}.
*/
boolean canBeRead(final URI objectURI);
/**
* Creates a new {@link FileInputIterator} for the given {@link URI}.
*
* @param objectURI the {@link URI} of the file object.
* @return a new {@link FileInputIterator} iterator instance.
*
*/
FileInputIterator<FileRecord<TypedStruct>> newIterator(final URI objectURI);
/**
* Close this reader and any remaining un-close iterators.
*/
@Override
void close();
}