Index (Naga API)
Date: 2016-06-28

A B C D E G I J L M N O P Q R S T V W Z

## A

acceptConnection(InetSocketAddress) - Method in interface naga.ConnectionAcceptor
  Return true if the connection should be accepted, false otherwise.
acceptFailed(IOException) - Method in class naga.examples.ChatServer
acceptFailed(IOException) - Method in interface naga.ServerSocketObserver
  Called by the NIOService on the NIO thread when an accept fails on the socket.
acceptFailed(IOException) - Method in class naga.ServerSocketObserverAdapter
ALLOW - Static variable in interface naga.ConnectionAcceptor
  A connection acceptor that accepts all connections.
AsciiLinePacketReader - Class in naga.packetreader
  Reads a bytestream delimited by '\n'.
AsciiLinePacketReader() - Constructor for class naga.packetreader.AsciiLinePacketReader
  Creates a '\n' delimited reader with an unlimited max buffer size.
AsciiLinePacketReader(int) - Constructor for class naga.packetreader.AsciiLinePacketReader
  Creates a '\n' delimited reader with the given max line length and default read buffer size.
AsciiLinePacketWriter - Class in naga.packetwriter
  Writes a bytestream delimited by '\n'.
AsciiLinePacketWriter() - Constructor for class naga.packetwriter.AsciiLinePacketWriter
asyncExecute(Runnable) - Method in class naga.eventmachine.EventMachine
  Execute a runnable on the Event/NIO thread.

## B

beginHandshake() - Method in interface naga.NIOSocketSSL
  Initiates SSL-handshake, starts encrypted communication.
broadcast(ChatServer.User, String) - Method in class naga.examples.ChatServer

## C

cancel() - Method in interface naga.eventmachine.DelayedEvent
  Cancels this delayed event.
cancelKeySilently(SelectionKey) - Static method in class naga.NIOUtils
  Silently cancel a key.
ChatServer - Class in naga.examples
  Creates a very simple chat server.
CipherPacketReader - Class in naga.packetreader
  Example filter reader that decrypts the stream before passing it to its underlying reader.
CipherPacketReader(Cipher, PacketReader) - Constructor for class naga.packetreader.CipherPacketReader
  Creates a new CipherPacketReader.
CipherPacketWriter - Class in naga.packetwriter
  Example Writer that encrypts the outgoing stream using a Cipher object.
CipherPacketWriter(Cipher, PacketWriter) - Constructor for class naga.packetwriter.CipherPacketWriter
close() - Method in interface naga.NIOAbstractSocket
  Closes this socket (the actual disconnect will occur on the NIOService thread)
close() - Method in class naga.NIOService
  Close the entire service.
closeAfterWrite() - Method in interface naga.NIOSocket
  Causes the socket to close after writing the current entries in the queue (consequent entries will be thrown away).
closeChannelSilently(Channel) - Static method in class naga.NIOUtils
  Silently close a channel.
closeEngine() - Method in class naga.SSLPacketHandler
closeKeyAndChannelSilently(SelectionKey, Channel) - Static method in class naga.NIOUtils
  Silently close both a key and a channel.
compact(ByteBuffer[]) - Static method in class naga.NIOUtils
  Compacts an array of byte buffers, retaining only the buffers that have remaining data.
concat(ByteBuffer[], ByteBuffer) - Static method in class naga.NIOUtils
concat(ByteBuffer, ByteBuffer[]) - Static method in class naga.NIOUtils
concat(ByteBuffer[], ByteBuffer[]) - Static method in class naga.NIOUtils
ConnectionAcceptor - Interface in naga
  The ConnectionAcceptor is used by the NIOServerSocket to determine if a connection should be accepted or refused.
connectionBroken(NIOSocket, Exception) - Method in interface naga.SocketObserver
  Called by the NIOService on the NIO thread when a connection is disconnected.
connectionBroken(NIOSocket, Exception) - Method in class naga.SocketObserverAdapter
connectionOpened(NIOSocket) - Method in interface naga.SocketObserver
  Called by the NIOService on the NIO thread when a connection completes on a socket.
connectionOpened(NIOSocket) - Method in class naga.SocketObserverAdapter
copy(ByteBuffer) - Static method in class naga.NIOUtils

## D

DEFAULT - Static variable in interface naga.ExceptionObserver
DEFAULT_IO_BUFFER_SIZE - Static variable in class naga.NIOService
DelayedEvent - Interface in naga.eventmachine
  A cancellable, delayed event posted to the event service.
DelimiterPacketReader - Class in naga.packetreader
  Class to read a byte stream delimited by a byte marking the end of a packet.
DelimiterPacketReader(byte) - Constructor for class naga.packetreader.DelimiterPacketReader
  Create a new reader with the default min buffer size and unlimited max buffer size.
DelimiterPacketReader(byte, int) - Constructor for class naga.packetreader.DelimiterPacketReader
  Create a new reader with the given min and max buffer size delimited by the given byte.
DelimiterPacketWriter - Class in naga.packetwriter
  Class to write a byte stream delimited by a byte marking the end of a packet.
DelimiterPacketWriter(byte) - Constructor for class naga.packetwriter.DelimiterPacketWriter
DENY - Static variable in interface naga.ConnectionAcceptor
  A connection acceptor that refuses all connections.

## E

EchoServer - Class in naga.examples
  Creates a very simple echo server.
EventMachine - Class in naga.eventmachine
  EventMachine is a simple event service for driving asynchronous and delayed tasks together with the a Naga NIOService.
EventMachine() - Constructor for class naga.eventmachine.EventMachine
  Creates a new EventMachine with an embedded NIOService.
ExceptionObserver - Interface in naga
  Implemented by observers of event exceptions.
executeAt(Runnable, Date) - Method in class naga.eventmachine.EventMachine
  Execute a runnable on the Event/NIO thread after at a certain time.
executeLater(Runnable, long) - Method in class naga.eventmachine.EventMachine
  Execute a runnable on the Event/NIO thread after a delay.

## G

getAddress() - Method in interface naga.NIOAbstractSocket
  Returns the InetSocketAddress for this socket.
getBufferSize() - Method in class naga.NIOService
  Returns the new shared buffer size.
getBytesRead() - Method in interface naga.NIOSocket
  Return the total number of bytes read on this socket since it was opened.
getBytesWritten() - Method in interface naga.NIOSocket
  Return the total number of bytes written on this socket since it was opened.
getCall() - Method in interface naga.eventmachine.DelayedEvent
  Returns the actual Runnable to be executed when this event runs.
getEventMachine() - Method in class naga.examples.ChatServer
getIp() - Method in interface naga.NIOAbstractSocket
  Reports the IP used by this socket.
getMaxPacketSize() - Method in class naga.packetreader.DelimiterPacketReader
  Get the current maximum buffer size.
getMaxQueueSize() - Method in interface naga.NIOSocket
  The current maximum queue size in bytes.
getNIOService() - Method in class naga.eventmachine.EventMachine
  Returns the NIOService used by this event service.
getPacketSizeFromByteArray(byte[], int, boolean) - Static method in class naga.NIOUtils
  Converts a value in a header byte array encoded in either big or little endian encoding.
getPacketSizeFromByteBuffer(ByteBuffer, int, boolean) - Static method in class naga.NIOUtils
  Converts a value in a header buffer encoded in either big or little endian encoding.
getPacketWriter() - Method in class naga.packetwriter.CipherPacketWriter
getPort() - Method in interface naga.NIOAbstractSocket
  Returns the port in use by this socket.
getQueue() - Method in class naga.eventmachine.EventMachine
  Return the current event service queue.
getQueue() - Method in class naga.NIOService
  Returns a copy of the internal event queue.
getQueueSize() - Method in class naga.eventmachine.EventMachine
  Return the current queue size.
getReader() - Method in class naga.packetreader.CipherPacketReader
getReader() - Method in class naga.SSLPacketHandler
getSSLContext() - Method in interface naga.NIOServerSocketSSL
  Returns the SSLContext in use.
getSSLEngine() - Method in interface naga.NIOSocketSSL
  Returns the SSLEngine in use for this socket.
getSSLEngine() - Method in class naga.SSLPacketHandler
getTag() - Method in interface naga.NIOAbstractSocket
  Returns the tag for this socket.
getTime() - Method in interface naga.eventmachine.DelayedEvent
  Returns the time when this event will execute.
getTimeOpen() - Method in interface naga.NIOSocket
  Return the time this socket has been open.
getTotalAcceptedConnections() - Method in interface naga.NIOServerSocket
  Returns the total number of accepted connections on this socket since it opened.
getTotalConnections() - Method in interface naga.NIOServerSocket
  Returns the total number of connections made on this socket since it opened.
getTotalFailedConnections() - Method in interface naga.NIOServerSocket
  Returns the total number of failed connections on this socket since it opened.
getTotalRefusedConnections() - Method in interface naga.NIOServerSocket
  Returns the total number of refused connections on this socket since it opened.
getWriteQueueSize() - Method in interface naga.NIOSocket
  This method returns the number of bytes queued for dispatch.
getWriter() - Method in class naga.SSLPacketHandler

## I

INSTANCE - Static variable in class naga.packetreader.RawPacketReader
INSTANCE - Static variable in class naga.packetwriter.RawPacketWriter
isEmpty(ByteBuffer[]) - Static method in class naga.NIOUtils
isEncrypted() - Method in interface naga.NIOSocketSSL
isEncrypted() - Method in class naga.SSLPacketHandler
isOpen() - Method in interface naga.NIOAbstractSocket
  Returns the current state of this socket.
isOpen() - Method in class naga.NIOService
  Determine if this service is open.

## J

join(ByteBuffer, ByteBuffer) - Static method in class naga.NIOUtils

## L

listen(ServerSocketObserver) - Method in interface naga.NIOServerSocket
  Associates a server socket observer with this server socket and starts accepting connections.
listen(SocketObserver) - Method in interface naga.NIOSocket
  Opens the socket for reads.

## M

main(String...) - Static method in class naga.examples.ChatServer
  Runs the echo server.
main(String...) - Static method in class naga.examples.EchoServer
  Runs the echo server.
main(String...) - Static method in class naga.examples.Rot13Server
  Runs the rot13 server.
main(String...) - Static method in class naga.examples.SSLTester
main(String...) - Static method in class naga.examples.ValidationClient
  Make a login request to the server.
main(String...) - Static method in class naga.examples.ValidationServer

## N

naga - package naga
  The main Naga classes.
naga.eventmachine - package naga.eventmachine
  An optional simple service for driving asynchronous and delayed tasks integrated with the Naga NIOService.
naga.examples - package naga.examples
  Various examples on how to use Naga.
naga.exception - package naga.exception
  Exceptions used by Naga.
naga.packetreader - package naga.packetreader
  Package containing various ready-to-use `PacketReader` implementations.
naga.packetwriter - package naga.packetwriter
  Package containing various ready-to-use `PacketWriter` implementations.
newConnection(NIOSocket) - Method in class naga.examples.ChatServer
newConnection(NIOSocket) - Method in interface naga.ServerSocketObserver
  Called by the NIOService on the NIO thread when a new connection has been accepted by the socket.
newConnection(NIOSocket) - Method in class naga.ServerSocketObserverAdapter
nextPacket(ByteBuffer) - Method in class naga.packetreader.CipherPacketReader
nextPacket(ByteBuffer) - Method in class naga.packetreader.DelimiterPacketReader
nextPacket(ByteBuffer) - Method in interface naga.PacketReader
  Create a new packet using the ByteBuffer given.
nextPacket(ByteBuffer) - Method in class naga.packetreader.RawPacketReader
nextPacket(ByteBuffer) - Method in class naga.packetreader.RegularPacketReader
nextPacket(ByteBuffer) - Method in class naga.packetreader.StreamCipherPacketReader
nextPacket(ByteBuffer) - Method in class naga.SSLPacketHandler
NIOAbstractSocket - Interface in naga
  An interface describing methods common to both NIOSocket and NIOServerSocket.
NIOServerSocket - Interface in naga
  Interface for the NIOServerSocket, which is an asynchronous facade to an underlying ServerSocket.
NIOServerSocketSSL - Interface in naga
  Interface for SSL Server Sockets
NIOService - Class in naga
  This class forms the basis of the NIO handling in Naga.
NIOService() - Constructor for class naga.NIOService
  Create a new nio service with default buffer size (64kb)
NIOService(int) - Constructor for class naga.NIOService
  Create a new nio service.
NIOSocket - Interface in naga
  Interface for the NIOSocket, which is an asynchronous facade to an underlying Socket.
NIOSocketSSL - Interface in naga
  Interface for a SSL Socket
NIOUtils - Class in naga
  A collection of utilites used by various classes.
notifyException(Throwable) - Method in class naga.NIOService
  Logs an exception using the exception observer.
notifyExceptionThrown(Throwable) - Method in interface naga.ExceptionObserver
  Notify the observer that an exception has been thrown.
NULL - Static variable in interface naga.SocketObserver
  A null object used as the default observer

## O

openServerSocket(int, int) - Method in class naga.NIOService
  Open a server socket on the given port.
openServerSocket(int) - Method in class naga.NIOService
  Open a server socket on the given port with the default connection backlog.
openServerSocket(InetSocketAddress, int) - Method in class naga.NIOService
  Open a server socket on the address.
openSocket(String, int) - Method in class naga.NIOService
  Open a normal socket to the host on the given port returning a NIOSocket.
openSocket(InetAddress, int) - Method in class naga.NIOService
  Open a normal socket to the host on the given port returning a NIOSocket.
openSSLServerSocket(SSLContext, int, int) - Method in class naga.NIOService
  Open an SSL server socket on the given port.
openSSLServerSocket(SSLContext, int) - Method in class naga.NIOService
  Open an SSL server socket on the given port with the default connection backlog.
openSSLServerSocket(SSLContext, InetSocketAddress, int) - Method in class naga.NIOService
  Open an SSL server socket on the address.
openSSLSocket(SSLEngine, String, int) - Method in class naga.NIOService
  Open a socket to the host on the given port returning a NIOSocketSSL.
openSSLSocket(SSLEngine, InetAddress, int) - Method in class naga.NIOService
  Open a socket to the host on the given port returning a NIOSocketSSL.

## P

PacketReader - Interface in naga
  Interface for packet reader plugins to assist a socket in reading.
packetReceived(NIOSocket, byte[]) - Method in interface naga.SocketObserver
  Called by the NIOService on the NIO thread when a packet is finished reading.
packetReceived(NIOSocket, byte[]) - Method in class naga.SocketObserverAdapter
packetSent(NIOSocket, Object) - Method in interface naga.SocketObserver
  Called by the NIOService on the NIO thread when a packet has finished writing.
packetSent(NIOSocket, Object) - Method in class naga.SocketObserverAdapter
PacketWriter - Interface in naga
  Interface for classes implementing packet writing strategies.
ProtocolViolationException - Exception in naga.exception
  Throw an exception due to unexpected data when reading packets.
ProtocolViolationException(String) - Constructor for exception naga.exception.ProtocolViolationException
  Create a new exception.

## Q

queue(Runnable) - Method in class naga.NIOService
  Queues an event on the NIOService queue.
queue(Runnable) - Method in interface naga.NIOSocket
  Queue a runnable in the packet queue.

## R

RawPacketReader - Class in naga.packetreader
  This packet reader reads as many bytes as possible from the stream and then bundles those bytes into a packet.
RawPacketWriter - Class in naga.packetwriter
  Writes a byte packet to the stream without doing any changes to it.
RegularPacketReader - Class in naga.packetreader
  Reads packet of the format
RegularPacketReader(int, boolean) - Constructor for class naga.packetreader.RegularPacketReader
  Creates a regular packet reader with the given header size.
RegularPacketWriter - Class in naga.packetwriter
  Writes packet of the format
RegularPacketWriter(int, boolean) - Constructor for class naga.packetwriter.RegularPacketWriter
  Creates a regular packet writer with the given header size.
remaining(ByteBuffer[]) - Static method in class naga.NIOUtils
Rot13Server - Class in naga.examples
  Creates a Rot13Server that takes a line of text and returns the Rot13 version of the text.

## S

selectBlocking() - Method in class naga.NIOService
  Run all waiting NIO requests, blocking indefinitely until at least one request is handled.
selectBlocking(long) - Method in class naga.NIOService
  Run all waiting NIO requests, blocking until at least one request is found, or the method has blocked for the time given by the timeout value, whatever comes first.
selectNonBlocking() - Method in class naga.NIOService
  Run all waiting NIO requests, returning immediately if no requests are found.
serverSocketDied(Exception) - Method in class naga.examples.ChatServer
serverSocketDied(Exception) - Method in interface naga.ServerSocketObserver
  Called by the NIOService on the NIO thread when the server socket is closed.
serverSocketDied(Exception) - Method in class naga.ServerSocketObserverAdapter
ServerSocketObserver - Interface in naga
  Implemented by an observer to a server socket.
ServerSocketObserverAdapter - Class in naga
  Class with null-implementations for all callbacks.
ServerSocketObserverAdapter() - Constructor for class naga.ServerSocketObserverAdapter
setBufferSize(int) - Method in class naga.NIOService
  Set the new shared buffer size.
setConnectionAcceptor(ConnectionAcceptor) - Method in interface naga.NIOServerSocket
  Sets the connection acceptor for this server socket.
setExceptionObserver(ExceptionObserver) - Method in class naga.NIOService
  Updates the exception observer for the NIOService.
setHeaderForPacketSize(byte[], int, int, boolean) - Static method in class naga.NIOUtils
  Inserts a header in the first bytes of a byte array in either big or little endian encoding (i.e.
setMaxPacketSize(int) - Method in class naga.packetreader.DelimiterPacketReader
  Set the new maximum packet size.
setMaxQueueSize(int) - Method in interface naga.NIOSocket
  Sets the maximum number of bytes allowed in the queue for this socket.
setObserver(ExceptionObserver) - Method in class naga.eventmachine.EventMachine
  Sets the ExceptionObserver for this service.
setPacketReader(PacketReader) - Method in interface naga.NIOSocket
  Sets the packet reader for this socket.
setPacketSizeInByteBuffer(ByteBuffer, int, int, boolean) - Static method in class naga.NIOUtils
  Encodes a length into byte buffer using either big or little endian encoding (i.e.
setPacketWriter(PacketWriter) - Method in interface naga.NIOSocket
  Sets the packet writer for this socket.
setPacketWriter(PacketWriter) - Method in class naga.packetwriter.CipherPacketWriter
setReader(PacketReader) - Method in class naga.packetreader.CipherPacketReader
setReader(PacketReader) - Method in class naga.SSLPacketHandler
setTag(Object) - Method in interface naga.NIOAbstractSocket
  Returns the tag for this socket.
setWriter(PacketWriter) - Method in class naga.SSLPacketHandler
shutdown() - Method in class naga.eventmachine.EventMachine
  Stops the event machine and closes the underlying NIO service, it is not possible to restart the event machine after shutdown.
SKIP_PACKET - Static variable in interface naga.PacketReader
socket() - Method in interface naga.NIOServerSocket
  Allows access to the underlying server socket.
socket() - Method in interface naga.NIOSocket
  Allows access to the underlying socket.
SocketObserver - Interface in naga
  This interface contains the callbacks used by a NIOSocket to inform its observer of events.
SocketObserverAdapter - Class in naga
  Class with null-implementation of all SocketObserver callbacks.
SocketObserverAdapter() - Constructor for class naga.SocketObserverAdapter
SSLPacketHandler - Class in naga
  Undocumented Class
SSLPacketHandler(SSLEngine, NIOSocket, SSLSocketChannelResponder) - Constructor for class naga.SSLPacketHandler
SSLTester - Class in naga.examples
  Undocumented Class
SSLTester() - Constructor for class naga.examples.SSLTester
start() - Method in class naga.eventmachine.EventMachine
  Causes the event machine to start running on a separate thread together with the NIOService.
stop() - Method in class naga.eventmachine.EventMachine
  Stops the event machine thread, it may be restarted using start()
StreamCipherPacketReader - Class in naga.packetreader
  Undocumented Class
StreamCipherPacketReader(Cipher, PacketReader) - Constructor for class naga.packetreader.StreamCipherPacketReader

## T

timeOfNextEvent() - Method in class naga.eventmachine.EventMachine
  Returns the time when the next scheduled event will execute.

## V

ValidationClient - Class in naga.examples
  A client for exercising the validation server.
ValidationServer - Class in naga.examples
  An example validation server to validate logins.

## W

wakeup() - Method in class naga.NIOService
  Runs wakeup on the selector, causing any blocking select to be released.
write(byte[]) - Method in interface naga.NIOSocket
  Write a packet of bytes asynchronously on this socket.
write(byte[], Object) - Method in interface naga.NIOSocket
  Write a packet of bytes asynchronously on this socket.
write(ByteBuffer[]) - Method in class naga.packetwriter.CipherPacketWriter
write(ByteBuffer[]) - Method in class naga.packetwriter.DelimiterPacketWriter
write(ByteBuffer[]) - Method in class naga.packetwriter.RawPacketWriter
write(ByteBuffer[]) - Method in class naga.packetwriter.RegularPacketWriter
write(ByteBuffer[]) - Method in interface naga.PacketWriter
  Convert the incoming bytes to the bytes to be serialized.
write(ByteBuffer[]) - Method in class naga.SSLPacketHandler

## Z

ZeroDelimitedPacketReader - Class in naga.packetreader
  Reads a bytestream delimited by 0.
ZeroDelimitedPacketReader() - Constructor for class naga.packetreader.ZeroDelimitedPacketReader
  Creates zero delimited reader with an unlimited max packet size.
ZeroDelimitedPacketReader(int) - Constructor for class naga.packetreader.ZeroDelimitedPacketReader
  Creates a zero delimited reader with the given max packet size and read buffer size.
ZeroDelimitedPacketWriter - Class in naga.packetwriter
  Writes a bytestream delimited by 0.
ZeroDelimitedPacketWriter() - Constructor for class naga.packetwriter.ZeroDelimitedPacketWriter

A B C D E G I J L M N O P Q R S T V W Z