org.apache.avro.mapred

## Class FsInput

- java.lang.Object
- - org.apache.avro.mapred.FsInput

- All Implemented Interfaces:
    Closeable, AutoCloseable, SeekableInput

      public class FsInput
      extends Object
      implements Closeable, SeekableInput

  Adapt an `FSDataInputStream` to `SeekableInput`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FsInput(Path path, Configuration conf)` Construct given a path and a configuration.
    `FsInput(Path path, FileSystem fileSystem)` Construct given a path and a `FileSystem`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `long` | `length()` Return the length of the file.
    `int` | `read(byte[] b, int off, int len)` Equivalent to `InputStream.read(byte[],int,int)`.
    `void` | `seek(long p)` Set the position for the next `read()`.
    `long` | `tell()` Return the position of the next `read()`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FsInput

          public FsInput(Path path,
                         Configuration conf)
                  throws IOException

      Construct given a path and a configuration.
      Throws:
        `IOException`

    - #### FsInput

          public FsInput(Path path,
                         FileSystem fileSystem)
                  throws IOException

      Construct given a path and a `FileSystem`.
      Throws:
        `IOException`

  - ### Method Detail

    - #### length

          public long length()

      Description copied from interface: `SeekableInput`
      Return the length of the file.
      Specified by:
        `length` in interface `SeekableInput`

    - #### read

          public int read(byte[] b,
                          int off,
                          int len)
                   throws IOException

      Description copied from interface: `SeekableInput`
      Equivalent to `InputStream.read(byte[],int,int)`.
      Specified by:
        `read` in interface `SeekableInput`
      Throws:
        `IOException`

    - #### seek

          public void seek(long p)
                    throws IOException

      Description copied from interface: `SeekableInput`
      Set the position for the next `read()`.
      Specified by:
        `seek` in interface `SeekableInput`
      Throws:
        `IOException`

    - #### tell

          public long tell()
                    throws IOException

      Description copied from interface: `SeekableInput`
      Return the position of the next `read()`.
      Specified by:
        `tell` in interface `SeekableInput`
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.