Package java.util

Examples of java.util.Scanner.useDelimiter()


    return responseBody;
  }

  private String getBoundary(final String contentType) throws BatchException {
    Scanner contentTypeScanner = new Scanner(contentType);
    contentTypeScanner.useDelimiter(";\\s?");
    if (contentTypeScanner.hasNext(REG_EX_CONTENT_TYPE)) {
      contentTypeScanner.next(REG_EX_CONTENT_TYPE);
    } else {
      contentTypeScanner.close();
      throw new BatchException(BatchException.INVALID_CONTENT_TYPE.addContent(HttpContentType.MULTIPART_MIXED));
View Full Code Here


  public static List<String> parseAcceptHeaders(final String headerValue) throws BatchException {
    TreeSet<Accept> acceptTree = getAcceptTree();
    List<String> acceptHeaders = new ArrayList<String>();
    Scanner acceptHeaderScanner = new Scanner(headerValue);
    acceptHeaderScanner.useDelimiter(",\\s?");
    while (acceptHeaderScanner.hasNext()) {
      if (acceptHeaderScanner.hasNext(REG_EX_ACCEPT_WITH_Q_FACTOR)) {
        acceptHeaderScanner.next(REG_EX_ACCEPT_WITH_Q_FACTOR);
        MatchResult result = acceptHeaderScanner.match();
        if (result.groupCount() == 2) {
View Full Code Here

  public static List<String> parseAcceptableLanguages(final String headerValue) throws BatchException {
    List<String> acceptLanguages = new LinkedList<String>();
    TreeSet<Accept> acceptTree = getAcceptTree();
    Scanner acceptLanguageScanner = new Scanner(headerValue);
    acceptLanguageScanner.useDelimiter(",\\s?");

    while (acceptLanguageScanner.hasNext()) {
      if (acceptLanguageScanner.hasNext(REG_EX_ACCEPT_LANGUAGES_WITH_Q_FACTOR)) {
        acceptLanguageScanner.next(REG_EX_ACCEPT_LANGUAGES_WITH_Q_FACTOR);
        MatchResult result = acceptLanguageScanner.match();
View Full Code Here

    batchRequestPathInfo = properties.getPathInfo();
  }

  public List<BatchRequestPart> parse(final InputStream in) throws BatchException {
    Scanner scanner = new Scanner(in, BatchHelper.DEFAULT_ENCODING);
    scanner.useDelimiter(LF);
    baseUri = getBaseUri();
    List<BatchRequestPart> requestList;
    try {
      requestList = parseBatchRequest(scanner);
    } finally {// NOPMD (suppress DoNotThrowExceptionInFinally)
View Full Code Here

    pathInfo.setPrecedingPathSegment(batchRequestPathInfo.getPrecedingSegments());
    final String odataPathSegmentsAsString;
    final String queryParametersAsString;
    try {
      Scanner uriScanner = new Scanner(uri);
      uriScanner.useDelimiter(LF);
      URI uriObject = new URI(uri);
      if (uriObject.isAbsolute()) {
        Pattern regexRequestUri = Pattern.compile(baseUri + "/([^/][^?]*)(\\?.*)?");
        if (uriScanner.hasNext(regexRequestUri)) {
          uriScanner.next(regexRequestUri);
View Full Code Here

  }

  private Map<String, String> parseQueryParameters(final String uri) throws BatchException {
    Scanner uriScanner = new Scanner(uri);
    uriScanner.useDelimiter("\n");
    Map<String, String> queryParametersMap = new HashMap<String, String>();
    Pattern regex = Pattern.compile("(?:" + baseUri + "/)?" + "[^?]+" + "\\?(.*)");
    if (uriScanner.hasNext(regex)) {
      uriScanner.next(regex);
      MatchResult uriResult = uriScanner.match();
View Full Code Here

      uriScanner.next(regex);
      MatchResult uriResult = uriScanner.match();
      if (uriResult.groupCount() == 1) {
        String queryParams = uriResult.group(1);
        Scanner queryParamsScanner = new Scanner(queryParams);
        queryParamsScanner.useDelimiter("&");
        while (queryParamsScanner.hasNext(REG_EX_QUERY_PARAMETER)) {
          queryParamsScanner.next(REG_EX_QUERY_PARAMETER);
          MatchResult result = queryParamsScanner.match();
          if (result.groupCount() == 2) {
            String systemQueryOption = result.group(1);
View Full Code Here

    return queryParametersMap;
  }

  private List<PathSegment> parseODataPathSegments(final String odataPathSegmentsAsString) {
    Scanner pathSegmentScanner = new Scanner(odataPathSegmentsAsString);
    pathSegmentScanner.useDelimiter("/");
    List<PathSegment> odataPathSegments = new ArrayList<PathSegment>();
    while (pathSegmentScanner.hasNext()) {
      odataPathSegments.add(new ODataPathSegmentImpl(pathSegmentScanner.next(), null));
    }
    pathSegmentScanner.close();
View Full Code Here

    return requestBody;
  }

  private String getBoundary(final String contentType) throws BatchException {
    Scanner contentTypeScanner = new Scanner(contentType);
    contentTypeScanner.useDelimiter(";\\s?");
    if (contentTypeScanner.hasNext(REG_EX_CONTENT_TYPE)) {
      contentTypeScanner.next(REG_EX_CONTENT_TYPE);
    } else {
      contentTypeScanner.close();
      throw new BatchException(BatchException.INVALID_CONTENT_TYPE.addContent(HttpContentType.MULTIPART_MIXED));
View Full Code Here

    null, "1", "2", "red", "blue"}// the null is required...
    int i;

    this.myHarness.checkPoint ("Fisch String [" + input + "]");
    Scanner s1 = new Scanner (input);
    s1.useDelimiter (delimiter);
    tmpStr = s1.delimiter ().pattern ();
    this.myHarness.check (tmpStr, delimiter,
        "get / setDelimiter fail (\"" + tmpStr +
        "\" != \"" + delimiter);
    this.myHarness.check (s1.hasNext (), true, "first hasNext()");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.