001/** 002 * 003 * Copyright (c) 2013 University of Le Havre 004 * 005 * @file NetStreamDecoder.java 006 * @date May 31, 2013 007 * 008 * @author Yoann Pigné 009 * 010 */ 011package org.graphstream.stream.netstream; 012 013import java.io.IOException; 014import java.io.InputStream; 015 016import org.graphstream.stream.thread.ThreadProxyPipe; 017 018/** 019 * 020 */ 021public interface NetStreamDecoder { 022 023 /** 024 * Gives the stream (a ThreadProxyPipe) identified with this name. If no 025 * pipe exists under this name, a new one is created and returned 026 * 027 * @param name 028 * Identifier of the stream. 029 * @return the identified pipe 030 */ 031 public abstract ThreadProxyPipe getStream(String name); 032 033 /** 034 * Gives the default stream (a ThreadProxyPipe) identified with the name 035 * "default". It is created if it does not exist. 036 * 037 * @return the default pipe 038 */ 039 040 public abstract ThreadProxyPipe getDefaultStream(); 041 042 /** 043 * Register a stream. All events with the given stream name will be directed 044 * to it. The user has to ensure the ThreadProxyPipe can be safely written 045 * to by the Receiver's thread. 046 * 047 * @param name 048 * Filter only message with this name to the given message box. 049 * @param stream 050 * The ThreadProxyPipe to push the events to. 051 * @throws Exception 052 * If another Pipe is already registered at the given name. 053 */ 054 public abstract void register(String name, ThreadProxyPipe stream) 055 throws Exception; 056 057 /** 058 * Decode one message. 059 */ 060 public abstract void decodeMessage(InputStream in) throws IOException; 061 062 /** 063 * Enable or disable debugging. 064 */ 065 public void setDebugOn(boolean on); 066}