it.unimi.di.mg4j.io
Interface IOFactory
- All Known Implementing Classes:
- HadoopFileSystemIOFactory
public interface IOFactory
A factory for streams.
Instances of this factory are used to make (at least partially)
index construction and access independent of the file system implementation.
For instance, FILESYSTEM_FACTORY
provides methods that are equivalent
to standard Java file handling, whereas HadoopFileSystemIOFactory
makes it
possible to use a Hadoop file system like HDFS to build indices.
Warning: I/O factories were introduced in 5.1,
and they are still somewhat experimental. Some parts of the code of MG4J might
still open directly files using java.io
's methods instead of
factory methods. Please report issues and inconsistent behaviour.
- Since:
- 5.1
- Author:
- Sebastiano Vigna
FILESYSTEM_FACTORY
static final IOFactory FILESYSTEM_FACTORY
getInputStream
InputStream getInputStream(String name)
throws IOException
- Throws:
IOException
getOutputStream
OutputStream getOutputStream(String name)
throws IOException
- Throws:
IOException
getWritableByteChannel
WritableByteChannel getWritableByteChannel(String name)
throws IOException
- Throws:
IOException
getReadableByteChannel
ReadableByteChannel getReadableByteChannel(String name)
throws IOException
- Throws:
IOException
exists
boolean exists(String name)
throws IOException
- Throws:
IOException
delete
boolean delete(String name)
throws IOException
- Throws:
IOException
createNewFile
void createNewFile(String name)
throws IOException
- Throws:
IOException
length
long length(String name)
throws IOException
- Throws:
IOException