Package 

Class ByteArraySource

  • All Implemented Interfaces:
    com.danikula.videocache.Source

    
    public class ByteArraySource
     implements Source
                        

    Simple memory based Source implementation.

    • Method Summary

      Modifier and Type Method Description
      int read(Array<byte> buffer) Read data to byte buffer from source with current offset.
      long length() Returns length bytes or negative value if length is unknown.
      void open(long offset) Opens source.
      void close() Closes source and release resources.
      • Methods inherited from class java.lang.Object

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

      • ByteArraySource

        ByteArraySource(Array<byte> data)
    • Method Detail

      • read

         int read(Array<byte> buffer)

        Read data to byte buffer from source with current offset.

        Parameters:
        buffer - a buffer to be used for reading data.
      • length

         long length()

        Returns length bytes or negative value if length is unknown.

      • open

         void open(long offset)

        Opens source. Source should be open before using read

        Parameters:
        offset - offset in bytes for source.
      • close

         void close()

        Closes source and release resources. Every opened source should be closed.