All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.logicartisan.io.log.LogAccess Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2013 Rob Eden.
 * All Rights Reserved.
 */

package com.logicartisan.io.log;

import java.io.IOException;


/**
 *
 */
public interface LogAccess {

	/**
	 * Returns the attachment associated with this instance.
	 */
	public A getAttachment();


	/**
	 * Retrieve a number of lines. Any lines that are unavailable will be set to null.
	 *
	 * @param start     The starting line index (zero-based).
	 * @param count     The number of lines to retrieve.
	 *
	 * @return  The array of lines. Will always be non-null and of length count.
	 * @throws IOException
	 */
	public String[] readLines( int start, int count ) throws IOException;


	/**
	 * Returns the current number of lines known in the file.
	 */
	public int getLineCount();


	/**
	 * Add a listener that is notified when additional indexing is done, such as when
	 * new lines are added to the file.
	 *
	 * @return      The current number of lines in the file.
	 */
	public int addListener( LogIndexListener listener );

	/**
	 * Remove a listener.
	 */
	public void removeListener( LogIndexListener listener );


	/**
	 * Starts a new search. Searches will continue to run until cancelled, or until
	 * communication errors occur to the listener.
	 *
	 * @param params        Parameters for the search.
	 * @param listener      The SearchListener that will be notified of search results.
	 *
	 * @return              The search ID.
	 */
	public int startSearch( SearchParams params, SearchListener listener );


	/**
	 * Cancels a currently running search.
	 */
	public void stopSearch( int search_id );
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy