com.funambol.syncml.client
Class FileObjectInputStream
java.lang.Object
java.io.InputStream
com.funambol.syncml.client.FileObjectInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class FileObjectInputStream
- extends java.io.InputStream
This class represents an input stream associated to a file object. A file
object is an XML representation of a file, as defined by OMA (see OMA File
Data Object Specification for more details).
The purpose of this class is to "decorate" a given input stream with a
prologue and an epilogue. The given input stream represents a file content,
while the prologue and epilogue represent the File Object meta information,
which is around the item content (see the FileObject definition for more
info). In order to obtain a proper prologue and epilogue, the user can use
the FileObject (@see FileObject) to create the prologue and epilogue via the
formatting methods.
This class is also responsible for encoding the content. The current
implementation always performs base64 encoding, so it expects FileObject
to generate a prologue with a base64 encoding for the body.
Constructor Summary |
FileObjectInputStream(java.lang.String prologue,
java.io.InputStream is,
java.lang.String epilogue,
int dataSize)
Constructs a FileObjectInputStream for the given input stream. |
Method Summary |
int |
available()
Returns the number of available bytes. |
void |
close()
|
int |
read()
Reads the next byte from the input stream. |
Methods inherited from class java.io.InputStream |
mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileObjectInputStream
public FileObjectInputStream(java.lang.String prologue,
java.io.InputStream is,
java.lang.String epilogue,
int dataSize)
- Constructs a FileObjectInputStream for the given input stream. The
prologue and epilogue contains the file object meta data.
- Parameters:
prologue
- is the FileObject prologue (the body must be reported as
base64 encoded)@is
- is the data input streamepilogue
- is the FileObject epiloguedataSize
- is the size of raw data to be read
read
public int read()
throws java.io.IOException
- Reads the next byte from the input stream. Initially the bytes returned
are the ones from the prologue, then the body content (which is base64
encoded) and finally the epilogue bytes.
- Specified by:
read
in class java.io.InputStream
- Returns:
- the next byte or -1 on end of stream
- Throws:
java.io.IOException
- if the underlying stream throws such an exception
available
public int available()
throws java.io.IOException
- Returns the number of available bytes.
- Overrides:
available
in class java.io.InputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.InputStream
- Throws:
java.io.IOException
Copyright © 2001-2009 Funambol.