Class SeekableResourceStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.hadoop.fs.PositionedReadable, org.apache.hadoop.fs.Seekable

    public class SeekableResourceStream
    extends java.io.InputStream
    implements org.apache.hadoop.fs.Seekable, org.apache.hadoop.fs.PositionedReadable
    Fake a Seekable stream from a Resource for testing
    • Constructor Summary

      Constructors 
      Constructor Description
      SeekableResourceStream​(org.openstreetmap.atlas.streaming.resource.Resource resource)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      long getPos()  
      int read()  
      int read​(long position, byte[] buffer, int offset, int length)  
      void readFully​(long position, byte[] buffer)  
      void readFully​(long position, byte[] buffer, int offset, int length)  
      void seek​(long pos)  
      boolean seekToNewSource​(long targetPos)  
      • Methods inherited from class java.io.InputStream

        available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SeekableResourceStream

        public SeekableResourceStream​(org.openstreetmap.atlas.streaming.resource.Resource resource)
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
      • getPos

        public long getPos()
                    throws java.io.IOException
        Specified by:
        getPos in interface org.apache.hadoop.fs.Seekable
        Throws:
        java.io.IOException
      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(long position,
                        byte[] buffer,
                        int offset,
                        int length)
                 throws java.io.IOException
        Specified by:
        read in interface org.apache.hadoop.fs.PositionedReadable
        Throws:
        java.io.IOException
      • readFully

        public void readFully​(long position,
                              byte[] buffer)
                       throws java.io.IOException
        Specified by:
        readFully in interface org.apache.hadoop.fs.PositionedReadable
        Throws:
        java.io.IOException
      • readFully

        public void readFully​(long position,
                              byte[] buffer,
                              int offset,
                              int length)
                       throws java.io.IOException
        Specified by:
        readFully in interface org.apache.hadoop.fs.PositionedReadable
        Throws:
        java.io.IOException
      • seek

        public void seek​(long pos)
                  throws java.io.IOException
        Specified by:
        seek in interface org.apache.hadoop.fs.Seekable
        Throws:
        java.io.IOException
      • seekToNewSource

        public boolean seekToNewSource​(long targetPos)
                                throws java.io.IOException
        Specified by:
        seekToNewSource in interface org.apache.hadoop.fs.Seekable
        Throws:
        java.io.IOException