Class RandomAccessInputStream

  • java.lang.Object
    • java.io.InputStream
      • at.ofai.music.util.RandomAccessInputStream


  • public class RandomAccessInputStream
    extends java.io.InputStream
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected long markPosition 
      protected java.io.RandomAccessFile r 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int available()
      Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.
      void close()
      Closes this input stream and releases any system resources associated with the stream.
      void mark()
      Marks the current position in this input stream.
      void mark(int readlimit)
      Marks the current position in this input stream.
      boolean markSupported()
      This input stream supports the mark and reset methods.
      int read()
      Reads the next byte of data from the input stream.
      int read(byte[] b)
      Reads some number of bytes from the input stream and stores them into the buffer array b.
      int read(byte[] b, int off, int len)
      Reads up to len bytes of data from the input stream into an array of bytes.
      void reset()
      Repositions this stream to the position at the time the mark method was last called on this input stream.
      long seekFromMark(long n)
      Seek to a position n bytes after the mark.
      long skip(long n)
      Skips over and discards n bytes of data from this input stream.
      • Methods inherited from class java.io.InputStream

        readAllBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

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

      • markPosition

        protected long markPosition
      • r

        protected java.io.RandomAccessFile r
    • Constructor Detail

      • RandomAccessInputStream

        public RandomAccessInputStream(java.io.File f)
                                throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
      • RandomAccessInputStream

        public RandomAccessInputStream(java.lang.String name)
                                throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
    • Method Detail

      • available

        public int available()
                      throws java.io.IOException
        Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Closes this input stream and releases any system resources associated with the stream.
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • mark

        public void mark(int readlimit)
        Marks the current position in this input stream. Warning: Use mark() instead of mark(int). IOExceptions are caught, because InputStream doesn't allow them to be thrown. The exception is printed and the mark position invalidated.
        Overrides:
        mark in class java.io.InputStream
        Parameters:
        readlimit - Ignored
      • mark

        public void mark()
                  throws java.io.IOException
        Marks the current position in this input stream.
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        This input stream supports the mark and reset methods.
        Overrides:
        markSupported in class java.io.InputStream
        Returns:
        true
      • read

        public int read()
                 throws java.io.IOException
        Reads the next byte of data from the input stream.
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read(byte[] b)
                 throws java.io.IOException
        Reads some number of bytes from the input stream and stores them into the buffer array b.
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Reads up to len bytes of data from the input stream into an array of bytes.
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • reset

        public void reset()
                   throws java.io.IOException
        Repositions this stream to the position at the time the mark method was last called on this input stream.
        Overrides:
        reset in class java.io.InputStream
        Throws:
        java.io.IOException
      • skip

        public long skip(long n)
                  throws java.io.IOException
        Skips over and discards n bytes of data from this input stream.
        Overrides:
        skip in class java.io.InputStream
        Throws:
        java.io.IOException
      • seekFromMark

        public long seekFromMark(long n)
                          throws java.io.IOException
        Seek to a position n bytes after the mark.
        Throws:
        java.io.IOException