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
-
-
Constructor Summary
Constructors Constructor Description FileBuffer(File file)
FileBuffer(File file, int offset, int sublen)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description File
getFile()
InputStream
getInputStream()
Caller must call readComplete()int
getLength()
Always valid if file existsint
getOffset()
Always validOutputStream
getOutputStream()
Caller must call writeComplete()void
readComplete(boolean success)
Top-level reader MUST call this to close the input stream.String
toString()
void
writeComplete(boolean success)
Deletes the file if success is false
-
-
-
Field Detail
-
_file
protected final File _file
-
_offset
protected final int _offset
-
_sublen
protected final int _sublen
-
-
Method Detail
-
getFile
public File getFile()
- Returns:
- the underlying file
-
getInputStream
public InputStream getInputStream() throws IOException
Caller must call readComplete()- Specified by:
getInputStream
in interfaceBuffer
- Returns:
- new FileInputStream
- Throws:
IOException
-
getOutputStream
public OutputStream getOutputStream() throws IOException
Caller must call writeComplete()- Specified by:
getOutputStream
in interfaceBuffer
- Returns:
- new FileOutputStream
- Throws:
IOException
-
readComplete
public void readComplete(boolean success)
Description copied from interface:Buffer
Top-level reader MUST call this to close the input stream.- Specified by:
readComplete
in interfaceBuffer
-
writeComplete
public void writeComplete(boolean success)
Deletes the file if success is false- Specified by:
writeComplete
in interfaceBuffer
- Parameters:
success
- if false, deletes any resources
-
getLength
public int getLength()
Always valid if file exists
-
-