public String toString() { return "MemcacheEntry{" + "bytes=" + bytesToString(bytes) + ", flag=" + flag + '}'; }
public String toString() { return "MemcacheEntry{" + "bytes=" + bytesToString(bytes) + ", flag=" + flag + '}'; }
public String getKey() { final int start = TextCommandConstants.VALUE_SPACE.length; for (int i = start; i < bytes.length; ++i) { if (bytes[i] == ' ') { return bytesToString(Arrays.copyOfRange(bytes, start, i)); } } return null; }
private String loadProtocol() { byte[] protocolBytes = new byte[PROTOCOL_LENGTH]; src.get(protocolBytes); return bytesToString(protocolBytes); }
@Override public String toString() { return "NoOpCommand {" + bytesToString(response.array()) + "}"; } }
@Override public String toString() { return "NoOpCommand {" + bytesToString(response.array()) + "}"; } }
public String getKey() { final int start = TextCommandConstants.VALUE_SPACE.length; for (int i = start; i < bytes.length; ++i) { if (bytes[i] == ' ') { return bytesToString(Arrays.copyOfRange(bytes, start, i)); } } return null; }
private String toStringAndClear(ByteBuffer bb) { if (bb == null) { return ""; } String result; if (bb.position() == 0) { result = ""; } else { result = StringUtil.bytesToString(bb.array(), 0, bb.position()); } bb.clear(); return result; }
private static String toStringAndClear(ByteBuffer bb) { if (bb == null) { return ""; } String result; if (bb.position() == 0) { result = ""; } else { result = StringUtil.bytesToString(bb.array(), 0, bb.position()); } bb.clear(); return result; }
private String toStringAndClear(ByteBuffer bb) { if (bb == null) { return ""; } String result; if (bb.position() == 0) { result = ""; } else { result = StringUtil.bytesToString(bb.array(), 0, bb.position()); } bb.clear(); return result; }
private static String toStringAndClear(ByteBuffer bb) { if (bb == null) { return ""; } String result; if (bb.position() == 0) { result = ""; } else { result = StringUtil.bytesToString(bb.array(), 0, bb.position()); } bb.clear(); return result; }
/** * Gets the password. * * @return the password */ public String getPassword() { checkNotNull(password); return bytesToString(password); }
/** * Gets the password. * * @return the password */ public String getPassword() { checkNotNull(password); return bytesToString(password); }
private String loadProtocol() { byte[] protocolBytes = new byte[PROTOCOL_LENGTH]; src.get(protocolBytes); if (isTlsHandshake(protocolBytes)) { // fail-fast throw new IllegalStateException("TLS handshake header detected, but plain protocol header was expected."); } return bytesToString(protocolBytes); }
/** * Decodes HTTP post params contained in {@link HttpPostCommand#getData()}. The data * should be encoded in UTF-8 and joined together with an ampersand (&). * * @param command the HTTP post command * @param paramCount the number of parameters expected in the command * @return the decoded params * @throws UnsupportedEncodingException If character encoding needs to be consulted, but * named character encoding is not supported */ private static String[] decodeParams(HttpPostCommand command, int paramCount) throws UnsupportedEncodingException { final byte[] data = command.getData(); final String[] encoded = bytesToString(data).split("&"); final String[] decoded = new String[encoded.length]; for (int i = 0; i < paramCount; i++) { decoded[i] = URLDecoder.decode(encoded[i], "UTF-8"); } return decoded; }
private boolean checkCredentials(HttpPostCommand command) throws UnsupportedEncodingException { byte[] data = command.getData(); if (data == null) { return false; } final String[] strList = bytesToString(data).split("&"); return authenticate(command, strList[0], strList.length > 1 ? strList[1] : null); }
private boolean checkCredentials(HttpPostCommand command) throws UnsupportedEncodingException { byte[] data = command.getData(); final String[] strList = bytesToString(data).split("&"); if (strList.length < 2) { return false; } final String groupName = URLDecoder.decode(strList[0], "UTF-8"); final String groupPass = URLDecoder.decode(strList[1], "UTF-8"); final GroupConfig groupConfig = textCommandService.getNode().getConfig().getGroupConfig(); return groupConfig.getName().equals(groupName) && groupConfig.getPassword().equals(groupPass); }
@Override public void readData(ObjectDataInput in) throws IOException { port = in.readInt(); type = in.readByte(); int len = in.readInt(); if (len > 0) { byte[] address = new byte[len]; in.readFully(address); host = bytesToString(address); } }
@Override public void readData(ObjectDataInput in) throws IOException { port = in.readInt(); type = in.readByte(); int len = in.readInt(); if (len > 0) { byte[] address = new byte[len]; in.readFully(address); host = bytesToString(address); } }
private void handleManagementCenterUrlChange(HttpPostCommand command) throws UnsupportedEncodingException { if (textCommandService.getNode().getProperties().getBoolean(GroupProperty.MC_URL_CHANGE_ENABLED)) { byte[] res = HttpCommand.RES_204; byte[] data = command.getData(); String[] strList = bytesToString(data).split("&"); String cluster = URLDecoder.decode(strList[0], "UTF-8"); String pass = URLDecoder.decode(strList[1], "UTF-8"); String url = URLDecoder.decode(strList[2], "UTF-8"); ManagementCenterService managementCenterService = textCommandService.getNode().getManagementCenterService(); if (managementCenterService != null) { res = managementCenterService.clusterWideUpdateManagementCenterUrl(cluster, pass, url); } command.setResponse(res); } else { command.setResponse(HttpCommand.RES_503); } }