public class Loader extends OutputStream
is much more efficient.
Constructor and Description |
---|
Loader(String fileName)
Creates a new instance of Loader
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Flushes this output stream and forces any buffered output bytes
to be written out.
|
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.
|
write
public Loader(String fileName) throws IOException
IOException
public void write(int b) throws IOException
b
are ignored.
write
in class OutputStream
b
- the byte
.IOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void write(byte[] b, int off, int len) throws IOException
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.
write
in class OutputStream
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.IOException
- if an I/O error occurs. In particular,
an IOException
is thrown if the output
stream is closed.public void flush() throws IOException
The flush
method of OutputStream
does nothing.
flush
in class OutputStream
IOException
- if an I/O error occurs.public void close() throws IOException
The flush
method of OutputStream
does nothing.
close
in class OutputStream
IOException
- if an I/O error occurs.public void LoadFrom(String fileName) throws IOException
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();
fileName
- Name of file to transfert to the Loader output stream (example: file:////usr/MyFile.txt
).IOException
- if an error occurs.