MCPcopy Create free account
hub / github.com/apache/avro / InputFile

Class InputFile

lang/java/trevni/core/src/main/java/org/apache/trevni/InputFile.java:27–51  ·  view source on GitHub ↗

An Input for files.

Source from the content-addressed store, hash-verified

25
26/** An {@link Input} for files. */
27public class InputFile implements Input {
28
29 private FileChannel channel;
30
31 /** Construct for the given file. */
32 public InputFile(File file) throws IOException {
33 this.channel = new FileInputStream(file).getChannel();
34 }
35
36 @Override
37 public long length() throws IOException {
38 return channel.size();
39 }
40
41 @Override
42 public int read(long position, byte[] b, int start, int len) throws IOException {
43 return channel.read(ByteBuffer.wrap(b, start, len), position);
44 }
45
46 @Override
47 public void close() throws IOException {
48 channel.close();
49 }
50
51}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…