Package ipsk.io

Class InsertInputStream

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

    public class InsertInputStream
    extends FramedEditingInputStream
    Inserts another input stream in this stream.
    Author:
    K.Jaensch, klausj@phonetik.uni-muenchen.de
    • Constructor Summary

      Constructors 
      Constructor Description
      InsertInputStream​(java.io.InputStream is, java.io.InputStream insert, int frameSize, long at)
      Creates inserting InputStream.
      InsertInputStream​(java.io.InputStream is, java.io.InputStream insert, long at)
      Insert stream insert to on stream is at the given position using framesize 1.
    • Method Summary

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

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

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

      • InsertInputStream

        public InsertInputStream​(java.io.InputStream is,
                                 java.io.InputStream insert,
                                 long at)
        Insert stream insert to on stream is at the given position using framesize 1.
      • InsertInputStream

        public InsertInputStream​(java.io.InputStream is,
                                 java.io.InputStream insert,
                                 int frameSize,
                                 long at)
        Creates inserting InputStream. At the given position the stream is inserted. First the bytes from the source stream are read until the given insert position is reached. Next the insert stream is read until its end. At least the rest of the source stream is read.
        Parameters:
        is - the underlying (source) InputStream
        insert - the inserted input stream
        frameSize - size of the data frames
        at - position where the insert stream is inserted in the source stream
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Overrides:
        read in class FramedInputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] buf,
                        int offset,
                        int len)
                 throws java.io.IOException
        Specified by:
        read in class FramedInputStream
        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
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available 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 FramedEditingInputStream
        Throws:
        java.io.IOException