public class DirectFileReadDataSource extends Object implements com.googlecode.mp4parser.DataSource
DataSource
implementation that relies on direct reads from a RandomAccessFile
.
It should be slower than FileDataSourceImpl
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 and Description |
---|
DirectFileReadDataSource(File f) |
Modifier and Type | Method and 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) |
public DirectFileReadDataSource(File f) throws IOException
IOException
public int read(ByteBuffer byteBuffer) throws IOException
read
in interface com.googlecode.mp4parser.DataSource
IOException
public int readAllInOnce(ByteBuffer byteBuffer) throws IOException
IOException
public long size() throws IOException
size
in interface com.googlecode.mp4parser.DataSource
IOException
public long position() throws IOException
position
in interface com.googlecode.mp4parser.DataSource
IOException
public void position(long nuPos) throws IOException
position
in interface com.googlecode.mp4parser.DataSource
IOException
public long transferTo(long position, long count, WritableByteChannel target) throws IOException
transferTo
in interface com.googlecode.mp4parser.DataSource
IOException
public ByteBuffer map(long startPosition, long size) throws IOException
map
in interface com.googlecode.mp4parser.DataSource
IOException
public void close() throws IOException
close
in interface com.googlecode.mp4parser.DataSource
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.