/** * @param groupName allow groupName is null * @param charsetName * @param cmd * @param errorNo * @return * @throws FdfsException */ public static byte[] createRequest(String groupName, String charsetName, byte cmd, byte errorNo) throws FdfsException { byte[] groupNameByteArr = null; int headerLength = 10; int bodyLength = 0; if (Strings.isNotBlank(groupName)) { // bodyLength = FDFS_GROUP_NAME_MAX_LEN; groupNameByteArr = Strings.getBytes(groupName, charsetName); } int totalLength = headerLength + bodyLength; WriteByteArrayFragment request = new WriteByteArrayFragment(totalLength); // writeHeader { request.writeLong(bodyLength); request.writeByte(cmd); request.writeByte(errorNo); } // writeBody { if (Strings.isNotBlank(groupName)) { // request.writeLimitedBytes(groupNameByteArr, FDFS_GROUP_NAME_MAX_LEN); } } return request.getData(); }
/** * Assert that the given text does not contain the given substring. * * <pre class="code"> * Assert.notContains(name, "rod", "Name must not contain 'rod'"); * </pre> * * @param textToSearch the text to search * @param substring the substring to find within the text * @param message the exception message to use if the assertion fails */ public static void notContains(String textToSearch, String substring, String message) { if (Strings.isNotBlank(textToSearch) && Strings.isNotBlank(substring) && textToSearch.indexOf(substring) != -1) { throw new IllegalArgumentException(message); } }