Class ObjectStream.Filter

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

    public static class ObjectStream.Filter
    extends ObjectStream
    Simple filter stream around another stream.

    ObjectLoader implementations can use this stream type when the object's content is available from a standard InputStream.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.InputStream in  
      private long size  
      private int type  
    • Constructor Summary

      Constructors 
      Constructor Description
      Filter​(int type, long size, java.io.InputStream in)
      Create a filter stream for an object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      void close()  
      long getSize()
      Get total size of object in bytes
      int getType()
      Get Git object type, see Constants.
      void mark​(int readlimit)  
      boolean markSupported()  
      int read()  
      int read​(byte[] b, int off, int len)  
      void reset()  
      long skip​(long n)  
      • Methods inherited from class java.io.InputStream

        read
      • Methods inherited from class java.lang.Object

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

      • type

        private final int type
      • size

        private final long size
      • in

        private final java.io.InputStream in
    • Constructor Detail

      • Filter

        public Filter​(int type,
                      long size,
                      java.io.InputStream in)
        Create a filter stream for an object.
        Parameters:
        type - the type of the object.
        size - total size of the object, in bytes.
        in - stream the object's raw data is available from. This stream should be buffered with some reasonable amount of buffering.
    • Method Detail

      • getSize

        public long getSize()
        Description copied from class: ObjectStream
        Get total size of object in bytes
        Specified by:
        getSize in class ObjectStream
        Returns:
        total size of object in bytes
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.InputStream
        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​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class java.io.InputStream
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException