simtools.logging
Class LoggingEntryByteBuffer

java.lang.Object
  extended by simtools.logging.LoggingEntryByteBuffer

public class LoggingEntryByteBuffer
extends java.lang.Object


Nested Class Summary
static class LoggingEntryByteBuffer.Handler
           
 
Constructor Summary
LoggingEntryByteBuffer()
           
LoggingEntryByteBuffer(int maxEntry)
           
 
Method Summary
protected  void add(java.nio.ByteBuffer b)
          Method add
Summary:
This method add the given byteBuffer to the buffer.
protected  int addOffset(int offset)
           
protected  void checkBufferSize(int length)
          Method checkBufferSize
Summary:
This method ensures that the buffer contains enought space to add length more bytes.
 void clear()
           
 void closeServer()
          Method closeServer
Summary:
Close the logSocketServer.
 int getLength()
           
 int getLevel(int index)
           
 java.lang.String getLoggerName(int index)
           
 java.lang.String getMessage(int index)
           
 long getMillis(int index)
           
 long getSequenceNumber(int index)
           
 int getSize()
           
 java.lang.String getSourceClassName(int index)
           
 java.lang.String getSourceMethodName(int index)
           
 int getThreadID(int index)
           
 int isSocketServerOpen()
          Method isSocketServerOpen
Summary:
Return the port used by the socketServer or -1 if no server is listening.
 void openServer(int port)
          Method openServer
Summary:
Open the LogSocketserver on the given port.
 void read(java.io.File f)
          Method read
Summary:
This method permits to read the given binary logfile, and put it in the current buffer.
protected  java.lang.String readException(org.w3c.dom.Node field, java.lang.String message)
           
 void readXML(java.io.File f)
           
 void readXML(java.io.File f, boolean append)
           
 void save(java.io.File f)
          Method save
Summary:
This method write the current buffer to the given file, in binary format.
 void setSize(int maxEntry)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggingEntryByteBuffer

public LoggingEntryByteBuffer()

LoggingEntryByteBuffer

public LoggingEntryByteBuffer(int maxEntry)
Method Detail

clear

public void clear()

readXML

public void readXML(java.io.File f)
             throws javax.xml.parsers.ParserConfigurationException,
                    org.xml.sax.SAXException,
                    java.io.IOException
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

readXML

public void readXML(java.io.File f,
                    boolean append)
             throws javax.xml.parsers.ParserConfigurationException,
                    org.xml.sax.SAXException,
                    java.io.IOException
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

readException

protected java.lang.String readException(org.w3c.dom.Node field,
                                         java.lang.String message)

read

public void read(java.io.File f)
          throws java.io.IOException
Method read
Summary:
This method permits to read the given binary logfile, and put it in the current buffer.

Parameters:
f - The file to open that contains binary logs.
Throws:
java.io.IOException

openServer

public void openServer(int port)
                throws java.io.IOException
Method openServer
Summary:
Open the LogSocketserver on the given port.

Parameters:
port - The port that the server will listen to.
Throws:
java.io.IOException

closeServer

public void closeServer()
                 throws java.io.IOException
Method closeServer
Summary:
Close the logSocketServer.

Throws:
java.io.IOException

isSocketServerOpen

public int isSocketServerOpen()
Method isSocketServerOpen
Summary:
Return the port used by the socketServer or -1 if no server is listening.

Returns:
(int) The port used by the socketServer or -1 if no server is listening.

save

public void save(java.io.File f)
          throws java.io.IOException
Method save
Summary:
This method write the current buffer to the given file, in binary format.

Parameters:
f - The file to write to.
Throws:
java.io.IOException

checkBufferSize

protected void checkBufferSize(int length)
Method checkBufferSize
Summary:
This method ensures that the buffer contains enought space to add length more bytes. If the buffer is not enough big, it double its capacity.

Parameters:
length - The number of bytes that the capacity could handle.

add

protected void add(java.nio.ByteBuffer b)
Method add
Summary:
This method add the given byteBuffer to the buffer.

Parameters:
b - The buffer to add to the logs.

addOffset

protected int addOffset(int offset)

getLength

public int getLength()

setSize

public void setSize(int maxEntry)

getSize

public int getSize()

getLevel

public int getLevel(int index)

getLoggerName

public java.lang.String getLoggerName(int index)

getMessage

public java.lang.String getMessage(int index)

getMillis

public long getMillis(int index)

getSequenceNumber

public long getSequenceNumber(int index)

getSourceClassName

public java.lang.String getSourceClassName(int index)

getSourceMethodName

public java.lang.String getSourceMethodName(int index)

getThreadID

public int getThreadID(int index)