Mercurial > hg > monetdb-java
view src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiServerResponseParser.java @ 74:17365ed26611 embedded
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
author | Pedro Ferreira <pedro.ferreira@monetdbsolutions.com> |
---|---|
date | Thu, 15 Dec 2016 11:25:04 +0100 (2016-12-15) |
parents | 87ba760038b6 |
children | 2b5e32efb1a4 |
line wrap: on
line source
package nl.cwi.monetdb.mcl.protocol.oldmapi; import nl.cwi.monetdb.mcl.protocol.ServerResponses; /** * Created by ferreira on 11/30/16. */ final class OldMapiServerResponseParser { static ServerResponses ParseOldMapiServerResponse(OldMapiProtocol protocol) { ServerResponses res; switch (protocol.lineBuffer.get()) { case '!': res = ServerResponses.ERROR; break; case '&': res = ServerResponses.SOHEADER; break; case '%': res = ServerResponses.HEADER; break; case '[': res = ServerResponses.RESULT; break; case '=': res = ServerResponses.RESULT; break; case '^': res = ServerResponses.REDIRECT; break; case '#': res = ServerResponses.INFO; break; case '.': res = ServerResponses.PROMPT; break; case ',': res = ServerResponses.MORE; break; default: res = ServerResponses.UNKNOWN; } return res; } }