public final class TSimpleFileTransport extends TTransport
| Constructor and Description |
|---|
TSimpleFileTransport(java.lang.String path)
Create a transport backed by a simple read only disk file (implicitly opens
file)
|
TSimpleFileTransport(java.lang.String path,
boolean read,
boolean write)
Create a transport backed by a simple file
Implicitly opens file to conform to C++ behavior.
|
TSimpleFileTransport(java.lang.String path,
boolean read,
boolean write,
boolean openFile)
Create a transport backed by a simple file
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close file, subsequent read/write activity will throw exceptions
|
long |
getFilePointer()
Return current file pointer position in bytes from beginning of file
|
boolean |
isOpen()
Test file status
|
long |
length()
Return the length of the file in bytes
|
void |
open()
Open file if not previously opened.
|
int |
read(byte[] buf,
int off,
int len)
Read up to len many bytes into buf at offset
|
void |
seek(long offset)
Move file pointer to specified offset, new read/write calls will act here
|
void |
write(byte[] buf,
int off,
int len)
Write len many bytes from buff starting at offset
|
consumeBuffer, flush, getBuffer, getBufferPosition, getBytesRemainingInBuffer, peek, readAll, writepublic TSimpleFileTransport(java.lang.String path,
boolean read,
boolean write,
boolean openFile)
throws TTransportException
path - the path to the file to open/createread - true to support read operationswrite - true to support write operationsopenFile - true to open the file on constructionTTransportException - if file open failspublic TSimpleFileTransport(java.lang.String path,
boolean read,
boolean write)
throws TTransportException
path - the path to the file to open/createread - true to support read operationswrite - true to support write operationsTTransportException - if file open failspublic TSimpleFileTransport(java.lang.String path)
throws TTransportException
path - the path to the file to open/createTTransportException - if file open failspublic boolean isOpen()
isOpen in class TTransportpublic void open()
throws TTransportException
open in class TTransportTTransportException - if open failspublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class TTransportpublic int read(byte[] buf,
int off,
int len)
throws TTransportException
read in class TTransportbuf - houses bytes readoff - offset into buff to begin writing tolen - maximum number of bytes to readTTransportException - on read failurepublic void write(byte[] buf,
int off,
int len)
throws TTransportException
write in class TTransportbuf - buffer containing bytes to writeoff - offset into buffer to begin writing fromlen - number of bytes to writeTTransportException - on write failurepublic void seek(long offset)
throws TTransportException
offset - bytes from beginning of file to move pointer toTTransportException - is seek failspublic long length()
throws TTransportException
TTransportException - if file access failspublic long getFilePointer()
throws TTransportException
TTransportException - if file access fails