public class DiskBackedByteStore extends ByteStore
| Modifier and Type | Class and Description |
|---|---|
static class |
DiskBackedByteStore.Factory |
| Modifier and Type | Field and Description |
|---|---|
protected com.evernote.client.conn.mobile.LazyByteArrayOutputStream |
mByteArrayOutputStream |
protected int |
mBytesWritten |
protected java.io.File |
mCacheDir |
protected java.io.File |
mCacheFile |
protected boolean |
mClosed |
protected java.io.OutputStream |
mCurrentOutputStream |
protected byte[] |
mData |
protected byte[] |
mFileBuffer |
protected java.io.FileOutputStream |
mFileOutputStream |
protected int |
mMaxMemory
The maximum amount of memory to use before writing to disk.
|
| Modifier | Constructor and Description |
|---|---|
protected |
DiskBackedByteStore(java.io.File cacheDir,
int maxMemory) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
getBytesWritten() |
byte[] |
getData()
The returned byte buffer very likely has a different size than the bytes written.
|
void |
reset()
Reset all pointers.
|
protected boolean |
swapped() |
protected void |
swapToDisk() |
void |
write(byte[] buffer,
int offset,
int count) |
void |
write(int oneByte) |
protected final int mMaxMemory
protected final java.io.File mCacheDir
protected final com.evernote.client.conn.mobile.LazyByteArrayOutputStream mByteArrayOutputStream
protected java.io.File mCacheFile
protected java.io.OutputStream mCurrentOutputStream
protected java.io.FileOutputStream mFileOutputStream
protected int mBytesWritten
protected boolean mClosed
protected byte[] mData
protected byte[] mFileBuffer
protected DiskBackedByteStore(java.io.File cacheDir,
int maxMemory)
cacheDir - A directory where the temporary data is stored.maxMemory - The threshold before the data is written to disk.public void write(byte[] buffer,
int offset,
int count)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(int oneByte)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionprotected boolean swapped()
protected void swapToDisk()
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionpublic int getBytesWritten()
getBytesWritten in class ByteStorepublic byte[] getData()
throws java.io.IOException
ByteStoreByteStore.getBytesWritten() bytes with no
offset.