Class FakeInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class FakeInputStream
    extends java.io.InputStream
    Fake InputStream: test class only
    • Constructor Summary

      Constructors 
      Constructor Description
      FakeInputStream​(long limit)
      Constructor of Fake InputStream

      Preferred constructor
      FakeInputStream​(long limit, boolean block)
      Constructor of Fake InputStream
      FakeInputStream​(long limit, boolean block, boolean useRandom)
      Constructor of Fake InputStream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      void close()  
      int read()  
      int read​(byte[] b)  
      int read​(byte[] b, int off, int len)  
      long readCount()  
      • Methods inherited from class java.io.InputStream

        mark, markSupported, nullInputStream, 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

      • FakeInputStream

        public FakeInputStream​(long limit)
        Constructor of Fake InputStream

        Preferred constructor
        Parameters:
        limit - the total size of the InputStream
      • FakeInputStream

        public FakeInputStream​(long limit,
                               boolean block)
        Constructor of Fake InputStream
        Parameters:
        limit - the total size of the InputStream
        block - True means the byte are read per block and False means one by one read
      • FakeInputStream

        public FakeInputStream​(long limit,
                               boolean block,
                               boolean useRandom)
        Constructor of Fake InputStream
        Parameters:
        limit - the total size of the InputStream
        block - True means the byte are read per block and False means one by one read
        useRandom - True use random values for each bytes, else 42 for each
    • Method Detail

      • read

        public int read()
        Specified by:
        read in class java.io.InputStream
      • available

        public int available()
        Overrides:
        available in class java.io.InputStream
      • 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
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
        Overrides:
        read in class java.io.InputStream
      • read

        public int read​(byte[] b)
        Overrides:
        read in class java.io.InputStream
      • readCount

        public long readCount()
        Returns:
        the number of truely read bytes