Package i2p.susi.util
Class FileBuffer
java.lang.Object
i2p.susi.util.FileBuffer
- All Implemented Interfaces:
Buffer
- Direct Known Subclasses:
GzipFileBuffer
public class FileBuffer extends Object implements Buffer
File implementation of Buffer.
- Since:
- 0.9.34
-
Field Summary
-
Constructor Summary
Constructors Constructor Description FileBuffer(File file)FileBuffer(File file, int offset, int sublen) -
Method Summary
Modifier and Type Method Description FilegetFile()InputStreamgetInputStream()Caller must call readComplete()intgetLength()Always valid if file existsintgetOffset()Always validOutputStreamgetOutputStream()Caller must call writeComplete()voidreadComplete(boolean success)Top-level reader MUST call this to close the input stream.StringtoString()voidwriteComplete(boolean success)Deletes the file if success is false
-
Field Details
-
Constructor Details
-
Method Details
-
getFile
- Returns:
- the underlying file
-
getInputStream
Caller must call readComplete()- Specified by:
getInputStreamin interfaceBuffer- Returns:
- new FileInputStream
- Throws:
IOException
-
getOutputStream
Caller must call writeComplete()- Specified by:
getOutputStreamin interfaceBuffer- Returns:
- new FileOutputStream
- Throws:
IOException
-
readComplete
public void readComplete(boolean success)Description copied from interface:BufferTop-level reader MUST call this to close the input stream.- Specified by:
readCompletein interfaceBuffer
-
writeComplete
public void writeComplete(boolean success)Deletes the file if success is false- Specified by:
writeCompletein interfaceBuffer- Parameters:
success- if false, deletes any resources
-
getLength
public int getLength()Always valid if file exists -
getOffset
public int getOffset()Always valid -
toString
-