Package com.guokr.simbase.errors

Examples of com.guokr.simbase.errors.ProtocolException


                    discr = readDiscr(line);
                    if (discr == SimUtils.STAR) {
                        state = State.READ_NARGS;
                    } else {
                        String msg = String.format("wrong byte %s('%c')", discr, discr);
                        throw new ProtocolException(msg);
                    }
                }
                break;
            case READ_NARGS:
                if (line != null && line.length() != 0) {
                    nargs = readSize(line);
                    if (nargs < 1) {
                        throw new ProtocolException();
                    }
                    state = State.READ_ARGUMENT;
                    requests.request(nargs);
                    line = null;
                }
                break;
            case READ_ARGUMENT:
                if (nargs > 0) {
                    line = lineReader.readLine(buffer);
                    if (line != null && line.length() != 0) {
                        discr = readDiscr(line);
                        if (discr == SimUtils.DOLLAR) {
                            state = State.READ_NBYTES;
                        }
                    }
                } else if (nargs == 0) {
                    state = State.READ_END;
                } else {
                    throw new ProtocolException();
                }
                break;
            case READ_NBYTES:
                if (line != null && line.length() != 0) {
                    nbytes = readSize(line);
View Full Code Here

TOP

Related Classes of com.guokr.simbase.errors.ProtocolException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.