com.ewon.ewonitf
Class Loader
java.lang.Object
java.io.OutputStream
com.ewon.ewonitf.Loader
public class Loader
- extends OutputStream
This class implements an OutputStream and allows to stream data directly in an eWON file.
The destination eWON file can be an eWON root file or a /usr file but for /usr file the
file connector is much more efficient.
Constructor Summary |
Loader(String fileName)
Creates a new instance of Loader |
Method Summary |
void |
close()
Flushes this output stream and forces any buffered output bytes
to be written out. |
protected void |
finalize()
|
void |
flush()
Flushes this output stream and forces any buffered output bytes
to be written out. |
void |
LoadFrom(String fileName)
Write the file described by the given connector to the Loader Stream.
This function is typically used after the stream has been created.
|
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array
starting at offset off to this output stream. |
void |
write(int b)
Writes the specified byte to this output stream. |
Loader
public Loader(String fileName)
throws IOException
- Creates a new instance of Loader
- Throws:
IOException
write
public void write(int b)
throws IOException
- Writes the specified byte to this output stream. The 24
high-order bits of
b
are ignored.
- Specified by:
write
in class OutputStream
- Parameters:
b
- the byte
.
- Throws:
IOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Writes
len
bytes from the specified byte array
starting at offset off
to this output stream.
This function actually buffers the data to internal writer system that
will flush the data when the buffer becomes full.
If b
is null
, a
NullPointerException
is thrown.
If off
is negative, or len
is negative, or
off+len
is greater than the length of the array
b
, then an IndexOutOfBoundsException is thrown.
- Overrides:
write
in class OutputStream
- Parameters:
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.
- Throws:
IOException
- if an I/O error occurs. In particular,
an IOException
is thrown if the output
stream is closed.
flush
public void flush()
throws IOException
- Flushes this output stream and forces any buffered output bytes
to be written out. The transfert operation is actually executed and may produce an error that
would not have been previousely generated during write.
The flush
method of OutputStream
does nothing.
- Overrides:
flush
in class OutputStream
- Throws:
IOException
- if an I/O error occurs.
close
public void close()
throws IOException
- Flushes this output stream and forces any buffered output bytes
to be written out. The transfert operation is actually executed and may produce an error that
would not have been previousely generated during write.
The flush
method of OutputStream
does nothing.
- Overrides:
close
in class OutputStream
- Throws:
IOException
- if an I/O error occurs.
LoadFrom
public void LoadFrom(String fileName)
throws IOException
- Write the file described by the given connector to the Loader Stream.
This function is typically used after the stream has been created.
Example:
Loader loader;
//This will load the /usr/MyFile.txt file to the eWON config file.
loader = new Loader("/config.txt");
loader.LoadFrom("file:////usr/MyFile.txt");
loader.close();
- Parameters:
fileName
- Name of file to transfert to the Loader output stream (example: file:////usr/MyFile.txt
).
- Throws:
IOException
- if an error occurs.
finalize
protected void finalize()
www.eWON.biz: Your Eyes Watching Over Net