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
ADataSourceimplementation that relies on direct reads from aRandomAccessFile. It should be slower thanFileDataSourceImplbut 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 voidclose()ByteBuffermap(long startPosition, long size)longposition()voidposition(long nuPos)intread(ByteBuffer byteBuffer)intreadAllInOnce(ByteBuffer byteBuffer)longsize()longtransferTo(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:
readin interfacecom.googlecode.mp4parser.DataSource- Throws:
IOException
-
readAllInOnce
public int readAllInOnce(ByteBuffer byteBuffer) throws IOException
- Throws:
IOException
-
size
public long size() throws IOException- Specified by:
sizein interfacecom.googlecode.mp4parser.DataSource- Throws:
IOException
-
position
public long position() throws IOException- Specified by:
positionin interfacecom.googlecode.mp4parser.DataSource- Throws:
IOException
-
position
public void position(long nuPos) throws IOException- Specified by:
positionin interfacecom.googlecode.mp4parser.DataSource- Throws:
IOException
-
transferTo
public long transferTo(long position, long count, WritableByteChannel target) throws IOException- Specified by:
transferToin interfacecom.googlecode.mp4parser.DataSource- Throws:
IOException
-
map
public ByteBuffer map(long startPosition, long size) throws IOException
- Specified by:
mapin interfacecom.googlecode.mp4parser.DataSource- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfacecom.googlecode.mp4parser.DataSource- Throws:
IOException
-
-