当前位置: 首页>>代码示例>>Java>>正文


Java StringUtil.splitc方法代码示例

本文整理汇总了Java中org.febit.util.StringUtil.splitc方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.splitc方法的具体用法?Java StringUtil.splitc怎么用?Java StringUtil.splitc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.febit.util.StringUtil的用法示例。


在下文中一共展示了StringUtil.splitc方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pathToSegment

import org.febit.util.StringUtil; //导入方法依赖的package包/类
protected static String[] pathToSegment(String path) {

        if (path == null) {
            return null;
        }

        String[] segments = StringUtil.splitc(path, '/');

        // if start with '/'
        if (segments.length != 0 && segments[0].isEmpty()) {
            segments = Arrays.copyOfRange(segments, 1, segments.length);
        }

        if (segments.length == 0) {
            return null;
        }
        return segments;
    }
 
开发者ID:febit,项目名称:febit,代码行数:19,代码来源:ActionMacroPath.java

示例2: parserIntegerArray

import org.febit.util.StringUtil; //导入方法依赖的package包/类
public static Integer[] parserIntegerArray(String value, int max) {
    if (value == null) {
        return null;
    }
    if (max > 0 && StringUtil.count(value, ',') > max) {
        return null;
    }
    String[] rawIds = StringUtil.splitc(value, ',');
    List<Integer> idList = new ArrayList<>(rawIds.length);
    for (String rawId : rawIds) {
        try {
            idList.add(Integer.parseInt(rawId));
        } catch (NumberFormatException ignore) {
        }
    }
    return idList.toArray(new Integer[idList.size()]);
}
 
开发者ID:febit,项目名称:febit-common,代码行数:18,代码来源:FieldUtil.java

示例3: parserLongArray

import org.febit.util.StringUtil; //导入方法依赖的package包/类
public static Long[] parserLongArray(String value, int max) {
    if (value == null) {
        return null;
    }
    if (max > 0 && StringUtil.count(value, ',') > max) {
        return null;
    }
    String[] rawIds = StringUtil.splitc(value, ',');
    List<Long> idList = new ArrayList<>(rawIds.length);
    for (String rawId : rawIds) {
        try {
            idList.add(Long.parseLong(rawId));
        } catch (NumberFormatException ignore) {
        }
    }
    return idList.toArray(new Long[idList.size()]);
}
 
开发者ID:febit,项目名称:febit-common,代码行数:18,代码来源:FieldUtil.java

示例4: valueOf

import org.febit.util.StringUtil; //导入方法依赖的package包/类
public static DependLib valueOf(String string) {
    if (string == null) {
        return null;
    }
    final String[] arr = StringUtil.splitc(string, ":");

    String group;
    String artifact = "";
    String version = null;
    String type = JAR;

    group = arr[0].trim();
    if (arr.length >= 2) {
        artifact = arr[1].trim();
        if (arr.length == 3) {
            version = arr[2].trim();
        } else if (arr.length == 4) {
            type = arr[2].trim();
            version = arr[3].trim();
        }
    }
    if (version != null && version.length() == 0) {
        version = null;
    }
    return new DependLib(group, artifact, version, type);
}
 
开发者ID:febit,项目名称:febit-generator,代码行数:27,代码来源:DependLib.java

示例5: valueOf

import org.febit.util.StringUtil; //导入方法依赖的package包/类
public static ColumnEnum valueOf(String string) {
    final String[] arr = StringUtil.splitc(string, '|');
    StringUtil.trim(arr);
    Short id;
    String name = "UNKOWN";
    String remark = "unkown";
    String value = arr[0];
    id = Short.valueOf(value);
    if (arr.length >= 2) {
        name = arr[1];
        if (arr.length == 3) {
            remark = arr[2];
        }
    }
    return new ColumnEnum(id, name, remark);
}
 
开发者ID:febit,项目名称:febit-generator,代码行数:17,代码来源:ColumnEnum.java

示例6: parseRequestStream

import org.febit.util.StringUtil; //导入方法依赖的package包/类
public void parseRequestStream(String encoding) throws IOException {
    if (parsed == true) {
        throw new IOException("Multi-part request already parsed");
    }
    parsed = true;

    final HttpServletRequest request = this.request;

    //parse queryString
    String queryString = request.getQueryString();
    if (queryString != null && !queryString.isEmpty()) {
        for (String raw : StringUtil.splitc(queryString, '&')) {
            int split = raw.indexOf('=');
            if (split >= 0) {
                putParameter(decodeUrl(raw.substring(0, split)).trim(),
                        decodeUrl(raw.substring(split + 1)).trim());
            } else {
                putParameter(decodeUrl(raw).trim(), "");
            }
        }
    }

    final MultipartRequestInputStream input = new MultipartRequestInputStream(request.getInputStream());
    input.readBoundary();
    while (true) {
        MultipartRequestHeader header = input.readDataHeader(encoding);
        if (header == null) {
            break;
        }

        if (header.isFile == true) {
            String fileName = header.fileName;
            if (fileName.length() > 0) {
                if (header.contentType.indexOf("application/x-macbinary") > 0) {
                    input.skipBytes(128);
                }
            }
            UploadFile newFile = fileUploadFactory.create(input);
            putFile(header.fieldName, newFile);
        } else {
            // no file, therefore it is regular form parameter.
            FastByteArrayOutputStream fbos = new FastByteArrayOutputStream();
            input.copyAll(fbos);
            String value = encoding != null ? new String(fbos.toByteArray(), encoding) : new String(fbos.toByteArray());
            putParameter(header.fieldName, value);
        }

        input.skipBytes(1);
        input.mark(1);

        // read byte, but may be end of stream
        int nextByte = input.read();
        if (nextByte == -1 || nextByte == '-') {
            input.reset();
            break;
        }
        input.reset();
    }
}
 
开发者ID:febit,项目名称:febit,代码行数:60,代码来源:MultipartRequestWrapper.java

示例7: splitcPathPattern

import org.febit.util.StringUtil; //导入方法依赖的package包/类
public static String[] splitcPathPattern(String path) {
    return StringUtil.splitc(path, PATH_SEPARATORS);
}
 
开发者ID:febit,项目名称:febit,代码行数:4,代码来源:Wildcard.java

示例8: create

import org.febit.util.StringUtil; //导入方法依赖的package包/类
public static IpSeeker create(final byte[] buffer) {

        //Head
        final ByteBuffer headBuf = ByteBuffer.wrap(buffer, 0, 4 * 258);
        final int headPos = headBuf.getInt();
        // we have 256 segments, and last is the end position
        final int[] segmentPos = new int[257];
        for (int i = 0; i < 257; i++) {
            segmentPos[i] = headBuf.getInt();
        }

        //Dict
        final String dictRaw = new String(Arrays.copyOfRange(buffer, headPos, segmentPos[0]), UTF_8);
        final String[] dict = StringUtil.splitc(dictRaw, '\001');

        dict[0] = null; // "None" => null

        //Segments
        final int[][] segments = new int[256][];
        final long[][] segmentIndexers = new long[256][];

        for (int i = 0; i < 256; i++) {
            int start = segmentPos[i];
            int end = segmentPos[i + 1];

            int len = (end - start) / 12; //(1 int + 1 long = 12 byte)

            int[] segment = new int[len];
            long[] segmentIndexer = new long[len];

            ByteBuffer buf = ByteBuffer.wrap(buffer, start, end - start);

            for (int j = 0; j < len; j++) {
                segment[j] = buf.getInt();
                segmentIndexer[j] = buf.getLong();
            }
            segments[i] = segment;
            segmentIndexers[i] = segmentIndexer;
        }

        //XXX 校验
        return new IpSeeker(dict, segments, segmentIndexers);
    }
 
开发者ID:febit,项目名称:febit,代码行数:44,代码来源:IpSeeker.java

示例9: compareVersion

import org.febit.util.StringUtil; //导入方法依赖的package包/类
protected int compareVersion(DependLib dep) {

        if (version == null) {
            if (dep.version == null) {
                return 0;
            } else {
                return -1;
            }
        } else {
            if (dep.version == null) {
                return 1;
            } else {
                if (version.equals(dep.version)) {
                    return 0;
                }
                String[] ver1 = StringUtil.splitc(version, ".-");
                String[] ver2 = StringUtil.splitc(dep.version, ".-");
                for (int i = 0; i < ver1.length && i < ver2.length; i++) {
                    try {
                        int v1 = Integer.parseInt(ver1[i]);
                        int v2 = Integer.parseInt(ver2[i]);
                        if (v1 == v2) {
                            continue;
                        }
                        return v1 - v2;
                    } catch (Exception e) {
                        if (ver1[i].equals(ver2[i])) {
                            continue;
                        }
                        return ver1[i].compareTo(ver2[i]);
                    }
                }
                //same at pre
                if (ver1.length == ver2.length) {
                    return 0;
                } else {
                    return ver1.length - ver2.length;
                }
            }
        }
    }
 
开发者ID:febit,项目名称:febit-generator,代码行数:42,代码来源:DependLib.java


注:本文中的org.febit.util.StringUtil.splitc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。