slash.common.io.Transfer.parseLong()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中slash.common.io.Transfer.parseLong()方法的一些代码示例,展示了Transfer.parseLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transfer.parseLong()方法的具体详情如下:
包路径:slash.common.io.Transfer
类名称:Transfer
方法名:parseLong

Transfer.parseLong介绍

暂无

代码示例

代码示例来源:origin: cpesch/RouteConverter

public Long getContentLength() throws IOException {
  return parseLong(getHeader(CONTENT_LENGTH));
}

代码示例来源:origin: cpesch/RouteConverter

private List<DistanceAndTime> parseDistanceAndTimeParameters(String parameters) {
  List<DistanceAndTime> result = new ArrayList<>();
  StringTokenizer tokenizer = new StringTokenizer(parameters, "/");
  while (tokenizer.hasMoreTokens()) {
    String distance = trim(tokenizer.nextToken());
    if (tokenizer.hasMoreTokens()) {
      String time = trim(tokenizer.nextToken());
      result.add(new DistanceAndTime(parseDouble(distance), parseLong(time)));
    }
  }
  return result;
}

代码示例来源:origin: cpesch/RouteConverter

private CompactCalendar parseTime(String time) {
  Long milliseconds = parseLong(time);
  if (isEmpty(milliseconds))
    return null;
  return fromMillis(milliseconds * 1000);
}

代码示例来源:origin: cpesch/RouteConverter

private CompactCalendar parseTime(String time) {
  Long milliseconds = parseLong(time);
  if (isEmpty(milliseconds))
    return null;
  return fromMillis(milliseconds * 1000);
}

代码示例来源:origin: cpesch/RouteConverter

TourPosition parsePosition(Map<String, String> map, String sectionTitle) {
  String zipCode = trim(map.get(ZIPCODE));
  String city = trim(map.get(CITY));
  String street = trim(map.get(STREET));
  String houseNo = trim(map.get(HOUSENO));
  String name = trim(map.get(NAME));
  Long x = parseLong(trim(map.get(LONGITUDE)));
  Long y = parseLong(trim(map.get(LATITUDE)));
  if (x == null || y == null)
    return null;
  map.remove(ZIPCODE);
  map.remove(CITY);
  map.remove(STREET);
  map.remove(HOUSENO);
  map.remove(NAME);
  map.remove(LONGITUDE);
  map.remove(LATITUDE);
  return new TourPosition(x, y, zipCode, city, street, houseNo, name, HOME_TITLE.equals(sectionTitle), map);
}

代码示例来源:origin: cpesch/RouteConverter

BcrPosition parsePosition(String client, String coordinate, String description) {
  Matcher coordinateMatcher = COORDINATES_VALUE_PATTERN.matcher(coordinate);
  if (!coordinateMatcher.matches())
    throw new IllegalArgumentException("'" + coordinate + "' does not match coordinates pattern");
  String x = coordinateMatcher.group(1);
  String y = coordinateMatcher.group(2);
  long altitude = NO_ALTITUDE_DEFINED;
  Matcher clientMatcher = ALTITUDE_VALUE_PATTERN.matcher(client);
  if (!clientMatcher.matches())
    log.info("'" + client + "' does not match client station pattern; ignoring it");
  else {
    String string = clientMatcher.group(2);
    try {
      Long aLong = parseLong(string);
      if (aLong != null)
        altitude = aLong;
    }
    catch (NumberFormatException e) {
      log.info("'" + string + "' is not a valid altitude; ignoring it");
    }
  }
  return new BcrPosition(parseInt(x), parseInt(y), altitude, trim(description));
}

相关文章