public class MaapiInputStream extends InputStream
This class is returned as result from
Maapi.saveConfig(int, java.util.EnumSet, String, Object...)
and
Maapi.rollbackConfig(int, String, String...)
.
The application is expected to close the
MaapiInputStream
after usage, to assure that background socket
is closed.
The instance return will open a new socket to the end server.
// String host = "localhost"; // int port = Conf.PORT for ConfD or Conf.NCS_PORT for NCS Socket s = new Socket(host, port); Maapi maapi = new Maapi(s); maapi.startUserSession("admin", InetAddress.getByName("localhost"), "maapi", new String[] { "admin" }, MaapiUserSessionFlag.PROTO_TCP); int tid = maapi.startTrans(Conf.DB_RUNNING, Conf.MODE_READ_WRITE); // Save the entire configuration MaapiInputStream in = maapi.saveConfig(tid, EnumSet.of(MaapiConfigFlag.MAAPI_CONFIG_C)); while ( (bytesRead = is.read (buf, 0, buf.length)) != -1 ) // do something with the buf.. is.close(); maapi.finishTrans(tid); s.close();
Modifier and Type | Method and Description |
---|---|
boolean |
hasReadAll()
Checks with the server is the complete configuration is downloaded.
|
int |
read()
read a byte from the input stream or -1 if EOF
|
int |
read(byte[] b,
int off,
int len) |
available, close, mark, markSupported, read, reset, skip
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public boolean hasReadAll()