Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package net.scattersphere.client.handler;
 
 
This class handles the "stream" command from the CLI. Created by kenji on 2/2/15.
    public StreamCommandHandler(PrintWriter outClient client) {
        super(outclient);
    }
    @Override
    public void handle(String[] args) {
        if (getClient().getClientConnection("Main").isConnected()) {
            if (args.length > 2) {
                String streamCommand = args[1];
                String streamId = args[2];
                switch(streamCommand.toLowerCase()) {
                    case "status":
                    case "size":
                        getClient().streamJob("Main"streamCommandstreamId);
                        break;
                    case "open":
                        StreamClientCache.instance().openStream(streamIdgetPrintWriter());
                        break;
                    case "close":
                        StreamClientCache.instance().closeStream(streamIdgetPrintWriter());
                        break;
                }
            } else {
                getPrintWriter().println("Stream: requires a command and stream ID.");
            }
        } else {
            getPrintWriter().println("Not connected.\n");
        }
    }
    @Override
    public boolean canHandle(String[] args) {
        return args != null && args.length > 0 && args[0].equalsIgnoreCase("stream");
    }
New to GrepCode? Check out our FAQ X