Package org.apache.tika.parser.mp4
Class DirectFileReadDataSource
- java.lang.Object
-
- org.apache.tika.parser.mp4.DirectFileReadDataSource
-
- All Implemented Interfaces:
com.googlecode.mp4parser.DataSource
,Closeable
,AutoCloseable
public class DirectFileReadDataSource extends Object implements com.googlecode.mp4parser.DataSource
ADataSource
implementation that relies on direct reads from aRandomAccessFile
. It should be slower thanFileDataSourceImpl
but does not incur the implicit file locks of memory mapped I/O on some JVMs. This implementation allows for a more controlled deletion of files and might be preferred when working with temporary files.
-
-
Constructor Summary
Constructors Constructor Description DirectFileReadDataSource(File f)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
ByteBuffer
map(long startPosition, long size)
long
position()
void
position(long nuPos)
int
read(ByteBuffer byteBuffer)
int
readAllInOnce(ByteBuffer byteBuffer)
long
size()
long
transferTo(long position, long count, WritableByteChannel target)
-
-
-
Constructor Detail
-
DirectFileReadDataSource
public DirectFileReadDataSource(File f) throws IOException
- Throws:
IOException
-
-
Method Detail
-
read
public int read(ByteBuffer byteBuffer) throws IOException
- Specified by:
read
in interfacecom.googlecode.mp4parser.DataSource
- Throws:
IOException
-
readAllInOnce
public int readAllInOnce(ByteBuffer byteBuffer) throws IOException
- Throws:
IOException
-
size
public long size() throws IOException
- Specified by:
size
in interfacecom.googlecode.mp4parser.DataSource
- Throws:
IOException
-
position
public long position() throws IOException
- Specified by:
position
in interfacecom.googlecode.mp4parser.DataSource
- Throws:
IOException
-
position
public void position(long nuPos) throws IOException
- Specified by:
position
in interfacecom.googlecode.mp4parser.DataSource
- Throws:
IOException
-
transferTo
public long transferTo(long position, long count, WritableByteChannel target) throws IOException
- Specified by:
transferTo
in interfacecom.googlecode.mp4parser.DataSource
- Throws:
IOException
-
map
public ByteBuffer map(long startPosition, long size) throws IOException
- Specified by:
map
in interfacecom.googlecode.mp4parser.DataSource
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfacecom.googlecode.mp4parser.DataSource
- Throws:
IOException
-
-