public class ClientSession extends Session
execute(java.lang.String, java.io.OutputStream)
method sends database commands to the server.
All strings are encoded as UTF8 and suffixed by a zero byte.close()
closes the session by sending the Commands.Cmd.EXIT
command to the server.Constructor and Description |
---|
ClientSession(Context context,
String username,
String password)
Constructor, specifying login data.
|
ClientSession(Context context,
String username,
String password,
OutputStream output)
Constructor, specifying login data and an output stream.
|
ClientSession(String host,
int port,
String username,
String password)
Constructor, specifying the server host:port combination and login data.
|
ClientSession(String host,
int port,
String username,
String password,
OutputStream output)
Constructor, specifying the server host:port combination, login data and an output stream.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String path,
InputStream input)
Adds a document to the opened database.
|
void |
close() |
void |
create(String name,
InputStream input)
Creates a database.
|
protected void |
execute(Command command,
OutputStream output)
Executes a command and prints the result to the specified output stream.
|
protected void |
execute(String command,
OutputStream output)
Executes a command and prints the result to the specified output stream.
|
ClientQuery |
query(String query)
Returns a query object for the specified query string.
|
void |
replace(String path,
InputStream input)
Replaces a document in an open database.
|
void |
store(String path,
InputStream input)
Stores raw data in an open database.
|
String |
toString() |
void |
unwatch(String name)
Unwatches an event.
|
void |
watch(String name,
EventNotifier notifier)
Watches an event.
|
execute, execute, getOutputStream, info, setOutputStream
public ClientSession(Context context, String username, String password) throws IOException
context
- database contextusername
- user namepassword
- password (plain text)IOException
- I/O exceptionpublic ClientSession(Context context, String username, String password, OutputStream output) throws IOException
context
- database contextusername
- user namepassword
- password (plain text)output
- client output; if set to null
, results will
be returned as strings.IOException
- I/O exceptionpublic ClientSession(String host, int port, String username, String password) throws IOException
host
- server nameport
- server portusername
- user namepassword
- password (plain text)IOException
- I/O exceptionpublic ClientSession(String host, int port, String username, String password, OutputStream output) throws IOException
host
- server nameport
- server portusername
- user namepassword
- password (plain text)output
- client output; if set to null
, results will
be returned as strings.IOException
- I/O exceptionpublic void create(String name, InputStream input) throws IOException
Session
create
in class Session
name
- name of databaseinput
- xml inputIOException
- I/O exceptionpublic void add(String path, InputStream input) throws IOException
Session
add
in class Session
path
- target pathinput
- xml inputIOException
- I/O exceptionpublic void replace(String path, InputStream input) throws IOException
Session
replace
in class Session
path
- document(s) to replaceinput
- new contentIOException
- I/O exceptionpublic void store(String path, InputStream input) throws IOException
Session
store
in class Session
path
- target pathinput
- binary inputIOException
- I/O exceptionpublic ClientQuery query(String query) throws IOException
Session
query
in class Session
query
- query stringIOException
- I/O exceptionpublic void close() throws IOException
IOException
protected void execute(String command, OutputStream output) throws IOException
Session
execute
in class Session
command
- command to be parsedoutput
- output streamIOException
- I/O exceptionprotected void execute(Command command, OutputStream output) throws IOException
Session
execute
in class Session
command
- command to be executedoutput
- output streamIOException
- I/O exceptionpublic void watch(String name, EventNotifier notifier) throws IOException
name
- event namenotifier
- event notificationIOException
- I/O exceptionpublic void unwatch(String name) throws IOException
name
- event nameIOException
- I/O exceptionCopyright © 2005–2015 BaseX Team. All rights reserved.