public static Command toRunClass( String runClass ) { return new Command( RUN_CLASS, runClass ); }
public static Command toRunClass( String runClass ) { return new Command( RUN_CLASS, runClass ); }
public static Command toShutdown( Shutdown shutdownType ) { return new Command( SHUTDOWN, shutdownType.name() ); }
public static Command toShutdown( Shutdown shutdownType ) { return new Command( SHUTDOWN, shutdownType.name() ); }
public static Command decode( DataInputStream is ) throws IOException { MasterProcessCommand command = resolve( is.readInt() ); if ( command == null ) { return null; } else { int dataLength = is.readInt(); if ( dataLength > 0 ) { byte[] buffer = new byte[ dataLength ]; is.readFully( buffer ); if ( command.getDataType() == Void.class ) { throw new IOException( format( "Command %s unexpectedly read Void data with length %d.", command, dataLength ) ); } String data = command.toDataTypeAsString( buffer ); return new Command( command, data ); } else { return new Command( command ); } } }
public static Command decode( DataInputStream is ) throws IOException { MasterProcessCommand command = resolve( is.readInt() ); if ( command == null ) { return null; } else { int dataLength = is.readInt(); if ( dataLength > 0 ) { byte[] buffer = new byte[ dataLength ]; is.readFully( buffer ); if ( command.getDataType() == Void.class ) { throw new IOException( format( "Command %s unexpectedly read Void data with length %d.", command, dataLength ) ); } String data = command.toDataTypeAsString( buffer ); return new Command( command, data ); } else { return new Command( command ); } } }