Tabnine Logo
BasicTokenIterator
Code IndexAdd Tabnine to your IDE (free)

How to use
BasicTokenIterator
in
org.apache.http.message

Best Java code snippets using org.apache.http.message.BasicTokenIterator (Showing top 20 results out of 315)

origin: robovm/robovm

  /**
   * Creates a token iterator from a header iterator.
   * This method can be overridden to replace the implementation of
   * the token iterator.
   *
   * @param hit       the header iterator
   *
   * @return  the token iterator
   */
  protected TokenIterator createTokenIterator(HeaderIterator hit) {
    return new BasicTokenIterator(hit);
  }
}
origin: robovm/robovm

} else {
  from = findTokenSeparator(from);
int start = findTokenStart(from);
if (start < 0) {
  this.currentToken = null;
int end = findTokenEnd(start);
this.currentToken = createToken(this.currentHeader, start, end);
return end;
origin: robovm/robovm

/**
 * Creates a new instance of {@link BasicTokenIterator}.
 *
 * @param headerIterator    the iterator for the headers to tokenize
 */
public BasicTokenIterator(final HeaderIterator headerIterator) {
  if (headerIterator == null) {
    throw new IllegalArgumentException
      ("Header iterator must not be null.");
  }
  this.headerIt = headerIterator;
  this.searchPos = findNext(-1);
}
origin: robovm/robovm

while (!found && (from < to)) {
  final char ch = this.currentHeader.charAt(from);
  if (isTokenSeparator(ch)) {
    found = true;
  } else if (isWhitespace(ch)) {
    from++;
  } else if (isTokenChar(ch)) {
    throw new ParseException
      ("Tokens without separator (pos " + from +
origin: robovm/robovm

/**
 * Determines the ending position of the current token.
 * This method will not leave the current header value,
 * since the end of the header value is a token boundary.
 *
 * @param from      the position of the first character of the token
 *
 * @return  the position after the last character of the token.
 *          The behavior is undefined if <code>from</code> does not
 *          point to a token character in the current header value.
 */
protected int findTokenEnd(int from) {
  if (from < 0) {
    throw new IllegalArgumentException
      ("Token start position must not be negative: " + from);
  }
  final int to = this.currentHeader.length();
  int end = from+1;
  while ((end < to) && isTokenChar(this.currentHeader.charAt(end))) {
    end++;
  }
  return end;
}
origin: robovm/robovm

/**
 * Checks whether a character is a valid token character.
 * Whitespace, control characters, and HTTP separators are not
 * valid token characters. The HTTP specification (RFC 2616, section 2.2)
 * defines tokens only for the US-ASCII character set, this
 * method extends the definition to other character sets.
 *
 * @param ch        the character to check
 *
 * @return  <code>true</code> if the character is a valid token start,
 *          <code>false</code> otherwise
 */
protected boolean isTokenChar(char ch) {
  // common sense extension of ALPHA + DIGIT
  if (Character.isLetterOrDigit(ch))
    return true;
  // common sense extension of CTL
  if (Character.isISOControl(ch))
    return false;
  // no common sense extension for this
  if (isHttpSeparator(ch))
    return false;
  // RFC 2616, section 2.2 defines a token character as
  // "any CHAR except CTLs or separators". The controls
  // and separators are included in the checks above.
  // This will yield unexpected results for Unicode format characters.
  // If that is a problem, overwrite isHttpSeparator(char) to filter
  // out the false positives.
  return true;
}
origin: robovm/robovm

if (isTokenSeparator(ch) || isWhitespace(ch)) {
} else if (isTokenChar(this.currentHeader.charAt(from))) {
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Determines the ending position of the current token.
 * This method will not leave the current header value,
 * since the end of the header value is a token boundary.
 *
 * @param from      the position of the first character of the token
 *
 * @return  the position after the last character of the token.
 *          The behavior is undefined if <code>from</code> does not
 *          point to a token character in the current header value.
 */
protected int findTokenEnd(int from) {
  if (from < 0) {
    throw new IllegalArgumentException
      ("Token start position must not be negative: " + from);
  }
  final int to = this.currentHeader.length();
  int end = from+1;
  while ((end < to) && isTokenChar(this.currentHeader.charAt(end))) {
    end++;
  }
  return end;
}
origin: MobiVM/robovm

/**
 * Checks whether a character is a valid token character.
 * Whitespace, control characters, and HTTP separators are not
 * valid token characters. The HTTP specification (RFC 2616, section 2.2)
 * defines tokens only for the US-ASCII character set, this
 * method extends the definition to other character sets.
 *
 * @param ch        the character to check
 *
 * @return  <code>true</code> if the character is a valid token start,
 *          <code>false</code> otherwise
 */
protected boolean isTokenChar(char ch) {
  // common sense extension of ALPHA + DIGIT
  if (Character.isLetterOrDigit(ch))
    return true;
  // common sense extension of CTL
  if (Character.isISOControl(ch))
    return false;
  // no common sense extension for this
  if (isHttpSeparator(ch))
    return false;
  // RFC 2616, section 2.2 defines a token character as
  // "any CHAR except CTLs or separators". The controls
  // and separators are included in the checks above.
  // This will yield unexpected results for Unicode format characters.
  // If that is a problem, overwrite isHttpSeparator(char) to filter
  // out the false positives.
  return true;
}
origin: MobiVM/robovm

while (!found && (from < to)) {
  final char ch = this.currentHeader.charAt(from);
  if (isTokenSeparator(ch)) {
    found = true;
  } else if (isWhitespace(ch)) {
    from++;
  } else if (isTokenChar(ch)) {
    throw new ParseException
      ("Tokens without separator (pos " + from +
origin: com.bugvm/bugvm-rt

} else {
  from = findTokenSeparator(from);
final int start = findTokenStart(from);
if (start < 0) {
  this.currentToken = null;
final int end = findTokenEnd(start);
this.currentToken = createToken(this.currentHeader, start, end);
return end;
origin: ibinti/bugvm

/**
 * Creates a token iterator from a header iterator.
 * This method can be overridden to replace the implementation of
 * the token iterator.
 *
 * @param hit       the header iterator
 *
 * @return  the token iterator
 */
protected TokenIterator createTokenIterator(final HeaderIterator hit) {
  return new BasicTokenIterator(hit);
}
origin: robovm/robovm

/**
 * Obtains the next token from this iteration.
 *
 * @return  the next token in this iteration
 *
 * @throws NoSuchElementException   if the iteration is already over
 * @throws ParseException   if an invalid header value is encountered
 */
public String nextToken()
  throws NoSuchElementException, ParseException {
  if (this.currentToken == null) {
    throw new NoSuchElementException("Iteration already finished.");
  }
  final String result = this.currentToken;
  // updates currentToken, may trigger ParseException:
  this.searchPos = findNext(this.searchPos);
  return result;
}
origin: MobiVM/robovm

/**
 * Determines the ending position of the current token.
 * This method will not leave the current header value,
 * since the end of the header value is a token boundary.
 *
 * @param from      the position of the first character of the token
 *
 * @return  the position after the last character of the token.
 *          The behavior is undefined if <code>from</code> does not
 *          point to a token character in the current header value.
 */
protected int findTokenEnd(int from) {
  if (from < 0) {
    throw new IllegalArgumentException
      ("Token start position must not be negative: " + from);
  }
  final int to = this.currentHeader.length();
  int end = from+1;
  while ((end < to) && isTokenChar(this.currentHeader.charAt(end))) {
    end++;
  }
  return end;
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Checks whether a character is a valid token character.
 * Whitespace, control characters, and HTTP separators are not
 * valid token characters. The HTTP specification (RFC 2616, section 2.2)
 * defines tokens only for the US-ASCII character set, this
 * method extends the definition to other character sets.
 *
 * @param ch        the character to check
 *
 * @return  <code>true</code> if the character is a valid token start,
 *          <code>false</code> otherwise
 */
protected boolean isTokenChar(char ch) {
  // common sense extension of ALPHA + DIGIT
  if (Character.isLetterOrDigit(ch))
    return true;
  // common sense extension of CTL
  if (Character.isISOControl(ch))
    return false;
  // no common sense extension for this
  if (isHttpSeparator(ch))
    return false;
  // RFC 2616, section 2.2 defines a token character as
  // "any CHAR except CTLs or separators". The controls
  // and separators are included in the checks above.
  // This will yield unexpected results for Unicode format characters.
  // If that is a problem, overwrite isHttpSeparator(char) to filter
  // out the false positives.
  return true;
}
origin: com.gluonhq/robovm-rt

while (!found && (from < to)) {
  final char ch = this.currentHeader.charAt(from);
  if (isTokenSeparator(ch)) {
    found = true;
  } else if (isWhitespace(ch)) {
    from++;
  } else if (isTokenChar(ch)) {
    throw new ParseException
      ("Tokens without separator (pos " + from +
origin: ibinti/bugvm

} else {
  from = findTokenSeparator(from);
final int start = findTokenStart(from);
if (start < 0) {
  this.currentToken = null;
final int end = findTokenEnd(start);
this.currentToken = createToken(this.currentHeader, start, end);
return end;
origin: com.bugvm/bugvm-rt

/**
 * Creates a token iterator from a header iterator.
 * This method can be overridden to replace the implementation of
 * the token iterator.
 *
 * @param hit       the header iterator
 *
 * @return  the token iterator
 */
protected TokenIterator createTokenIterator(final HeaderIterator hit) {
  return new BasicTokenIterator(hit);
}
origin: MobiVM/robovm

/**
 * Creates a new instance of {@link BasicTokenIterator}.
 *
 * @param headerIterator    the iterator for the headers to tokenize
 */
public BasicTokenIterator(final HeaderIterator headerIterator) {
  if (headerIterator == null) {
    throw new IllegalArgumentException
      ("Header iterator must not be null.");
  }
  this.headerIt = headerIterator;
  this.searchPos = findNext(-1);
}
origin: com.gluonhq/robovm-rt

/**
 * Determines the ending position of the current token.
 * This method will not leave the current header value,
 * since the end of the header value is a token boundary.
 *
 * @param from      the position of the first character of the token
 *
 * @return  the position after the last character of the token.
 *          The behavior is undefined if <code>from</code> does not
 *          point to a token character in the current header value.
 */
protected int findTokenEnd(int from) {
  if (from < 0) {
    throw new IllegalArgumentException
      ("Token start position must not be negative: " + from);
  }
  final int to = this.currentHeader.length();
  int end = from+1;
  while ((end < to) && isTokenChar(this.currentHeader.charAt(end))) {
    end++;
  }
  return end;
}
org.apache.http.messageBasicTokenIterator

Javadoc

Basic implementation of a TokenIterator. This implementation parses #token sequences as defined by RFC 2616, section 2. It extends that definition somewhat beyond US-ASCII.

Most used methods

  • <init>
    Creates a new instance of BasicTokenIterator.
  • createToken
    Creates a new token to be returned. Called from #findNext after the token is identified. The default
  • findNext
    Determines the next token. If found, the token is stored in #currentToken. The return value indicate
  • findTokenEnd
    Determines the ending position of the current token. This method will not leave the current header v
  • findTokenSeparator
    Determines the position of the next token separator. Because of multi-header joining rules, the end
  • findTokenStart
    Determines the starting position of the next token. This method will iterate over headers if necessa
  • isHttpSeparator
    Checks whether a character is an HTTP separator. The implementation in this class checks only for th
  • isTokenChar
    Checks whether a character is a valid token character. Whitespace, control characters, and HTTP sepa
  • isTokenSeparator
    Checks whether a character is a token separator. RFC 2616, section 2.1 defines comma as the separato
  • isWhitespace
    Checks whether a character is a whitespace character. RFC 2616, section 2.2 defines space and horizo
  • nextToken
    Obtains the next token from this iteration.
  • nextToken

Popular in Java

  • Making http post requests using okhttp
  • setRequestProperty (URLConnection)
  • getSystemService (Context)
  • setScale (BigDecimal)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now