/** * @param reliable The ReliableFile on which to read. * @param generation a specific generation requested. * @param openMask mask used to open data. are invalid (corrupt, missing, etc). * @throws IOException If an error occurs opening the file. */ private ReliableFileInputStream(ReliableFile reliable, int generation, int openMask) throws IOException { super(reliable.getInputStream(generation, openMask)); this.reliable = reliable; sigSize = reliable.getSignatureSize(); readPos = 0; length = super.available(); if (sigSize > length) length = 0; // shouldn't ever happen else length -= sigSize; }
/** * Closes this input stream and releases any system resources associated with the stream. * * @exception java.io.IOException If an error occurs closing the file. */ public synchronized void close() throws IOException { if (reliable != null) { try { super.close(); } finally { reliable.closeInputFile(); reliable = null; } } }
/** * Constructs a new ReliableFileInputStream on the File <code>file</code>. If the file does not * exist, the <code>FileNotFoundException</code> is thrown. * * @param file the File on which to stream reads. * @param generation a specific generation requested. * @param openMask mask used to open data. are invalid (corrupt, missing, etc). * @exception java.io.IOException If an error occurs opening the file. */ public ReliableFileInputStream(File file, int generation, int openMask) throws IOException { this(ReliableFile.getReliableFile(file), generation, openMask); }
/** * Constructs a new ReliableFileInputStream on the File <code>file</code>. If the file does not * exist, the <code>FileNotFoundException</code> is thrown. * * @param file the File on which to stream reads. * @exception java.io.IOException If an error occurs opening the file. */ public ReliableFileInputStream(File file) throws IOException { this( ReliableFile.getReliableFile(file), ReliableFile.GENERATION_LATEST, ReliableFile.OPEN_BEST_AVAILABLE); }