public class

DiskBackedByteStore

extends OutputStream
java.lang.Object
   ↳ java.io.OutputStream
     ↳ com.evernote.client.conn.mobile.DiskBackedByteStore

Class Overview

Implements an OutputStream that stores data to a temporary file on disk. Used by TAndroidHttpClient to write Thrift messages to disk before POSTing them to the Thrift server.

You should not need to interact with this class directly.

Summary

Fields
protected ByteArrayOutputStream byteArray
protected OutputStream current
protected Exception exception
protected File file
protected FileInputStream fileInputStream
protected FileOutputStream fileoutputStream
protected int maxMemory The maximum amount of memory to use before writing to disk
protected int size
protected File tempPath
Public Constructors
DiskBackedByteStore(File file, int maxMemory)
Constructor that sets the exact name of the file to use if we have to swap data out to secondary store.
DiskBackedByteStore(File parentDir, String prefix, int maxMemory)
Public Methods
void clear()
Exception getException()
InputStream getInputStream()
int getSize()
void reset()
void write(byte[] buffer, int offset, int count)
void write(int oneByte)
Protected Methods
File makeTempFile()
void swapToDisk()
[Expand]
Inherited Methods
From class java.io.OutputStream
From class java.lang.Object
From interface java.io.Closeable
From interface java.io.Flushable

Fields

protected ByteArrayOutputStream byteArray

protected OutputStream current

protected Exception exception

protected File file

protected FileInputStream fileInputStream

protected FileOutputStream fileoutputStream

protected int maxMemory

The maximum amount of memory to use before writing to disk

protected int size

protected File tempPath

Public Constructors

public DiskBackedByteStore (File file, int maxMemory)

Constructor that sets the exact name of the file to use if we have to swap data out to secondary store.

Parameters
file The full pathname where we will swap data.
maxMemory The size, in bytes, that we will buffer until we swap.

public DiskBackedByteStore (File parentDir, String prefix, int maxMemory)

Throws
IOException

Public Methods

public void clear ()

public Exception getException ()

public InputStream getInputStream ()

Throws
IOException

public int getSize ()

public void reset ()

Throws
IOException

public void write (byte[] buffer, int offset, int count)

public void write (int oneByte)

Protected Methods

protected File makeTempFile ()

protected void swapToDisk ()

Throws
FileNotFoundException
IOException