Java Doc for BasicTokenIterator.java in  » Net » httpcomponents-core-4.0-beta1 » org » apache » http » message » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » httpcomponents core 4.0 beta1 » org.apache.http.message 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.http.message.BasicTokenIterator

BasicTokenIterator
public class BasicTokenIterator implements TokenIterator(Code)
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.
version:
   $Revision: 602520 $


Field Summary
final public static  StringHTTP_SEPARATORS
     The HTTP separator characters.
protected  StringcurrentHeader
     The value of the current header.
protected  StringcurrentToken
     The token to be returned by the next call to BasicTokenIterator.currentToken .
final protected  HeaderIteratorheaderIt
     The iterator from which to obtain the next header.
protected  intsearchPos
     The position after BasicTokenIterator.currentToken in BasicTokenIterator.currentHeader .

Constructor Summary
public  BasicTokenIterator(HeaderIterator headerIterator)
     Creates a new instance of BasicTokenIterator .

Method Summary
protected  StringcreateToken(String value, int start, int end)
     Creates a new token to be returned. Called from BasicTokenIterator.findNext findNext after the token is identified. The default implementation simply calls java.lang.String.substring String.substring .
If header values are significantly longer than tokens, and some tokens are permanently referenced by the application, there can be problems with garbage collection.
protected  intfindNext(int from)
     Determines the next token. If found, the token is stored in BasicTokenIterator.currentToken . The return value indicates the position after the token in BasicTokenIterator.currentHeader .
protected  intfindTokenEnd(int from)
     Determines the ending position of the current token.
protected  intfindTokenSeparator(int from)
     Determines the position of the next token separator. Because of multi-header joining rules, the end of a header value is a token separator.
protected  intfindTokenStart(int from)
     Determines the starting position of the next token.
public  booleanhasNext()
    
protected  booleanisHttpSeparator(char ch)
     Checks whether a character is an HTTP separator. The implementation in this class checks only for the HTTP separators defined in RFC 2616, section 2.2.
protected  booleanisTokenChar(char ch)
     Checks whether a character is a valid token character. Whitespace, control characters, and HTTP separators are not valid token characters.
protected  booleanisTokenSeparator(char ch)
     Checks whether a character is a token separator. RFC 2616, section 2.1 defines comma as the separator for #token sequences.
protected  booleanisWhitespace(char ch)
     Checks whether a character is a whitespace character.
final public  Objectnext()
     Returns the next token.
public  StringnextToken()
     Obtains the next token from this iteration.
final public  voidremove()
     Removing tokens is not supported.

Field Detail
HTTP_SEPARATORS
final public static String HTTP_SEPARATORS(Code)
The HTTP separator characters. Defined in RFC 2616, section 2.2.



currentHeader
protected String currentHeader(Code)
The value of the current header. This is the header value that includes BasicTokenIterator.currentToken . Undefined if the iteration is over.



currentToken
protected String currentToken(Code)
The token to be returned by the next call to BasicTokenIterator.currentToken . null if the iteration is over.



headerIt
final protected HeaderIterator headerIt(Code)
The iterator from which to obtain the next header.



searchPos
protected int searchPos(Code)
The position after BasicTokenIterator.currentToken in BasicTokenIterator.currentHeader . Undefined if the iteration is over.




Constructor Detail
BasicTokenIterator
public BasicTokenIterator(HeaderIterator headerIterator)(Code)
Creates a new instance of BasicTokenIterator .
Parameters:
  headerIterator - the iterator for the headers to tokenize




Method Detail
createToken
protected String createToken(String value, int start, int end)(Code)
Creates a new token to be returned. Called from BasicTokenIterator.findNext findNext after the token is identified. The default implementation simply calls java.lang.String.substring String.substring .
If header values are significantly longer than tokens, and some tokens are permanently referenced by the application, there can be problems with garbage collection. A substring will hold a reference to the full characters of the original string and therefore occupies more memory than might be expected. To avoid this, override this method and create a new string instead of a substring.
Parameters:
  value - the full header value from which to create a token
Parameters:
  start - the index of the first token character
Parameters:
  end - the index after the last token character a string representing the token identified by the arguments



findNext
protected int findNext(int from) throws ParseException(Code)
Determines the next token. If found, the token is stored in BasicTokenIterator.currentToken . The return value indicates the position after the token in BasicTokenIterator.currentHeader . If necessary, the next header will be obtained from BasicTokenIterator.headerIt . If not found, BasicTokenIterator.currentToken is set to null.
Parameters:
  from - the position in the current header at which tostart the search, -1 to search in the first header the position after the found token in the current header, ornegative if there was no next token
throws:
  ParseException - if an invalid header value is encountered



findTokenEnd
protected int findTokenEnd(int from)(Code)
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.
Parameters:
  from - the position of the first character of the token the position after the last character of the token.The behavior is undefined if from does notpoint to a token character in the current header value.



findTokenSeparator
protected int findTokenSeparator(int from)(Code)
Determines the position of the next token separator. Because of multi-header joining rules, the end of a header value is a token separator. This method does therefore not need to iterate over headers.
Parameters:
  from - the position in the current header at which tostart the search the position of a token separator in the current header,or at the end
throws:
  ParseException - if a new token is found before a token separator.RFC 2616, section 2.1 explicitly requires a comma betweentokens for #.



findTokenStart
protected int findTokenStart(int from)(Code)
Determines the starting position of the next token. This method will iterate over headers if necessary.
Parameters:
  from - the position in the current header at which tostart the search the position of the token start in the current header,negative if no token start could be found



hasNext
public boolean hasNext()(Code)



isHttpSeparator
protected boolean isHttpSeparator(char ch)(Code)
Checks whether a character is an HTTP separator. The implementation in this class checks only for the HTTP separators defined in RFC 2616, section 2.2. If you need to detect other separators beyond the US-ASCII character set, override this method.
Parameters:
  ch - the character to check true if the character is an HTTP separator



isTokenChar
protected boolean isTokenChar(char ch)(Code)
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.
Parameters:
  ch - the character to check true if the character is a valid token start,false otherwise



isTokenSeparator
protected boolean isTokenSeparator(char ch)(Code)
Checks whether a character is a token separator. RFC 2616, section 2.1 defines comma as the separator for #token sequences. The end of a header value will also separate tokens, but that is not a character check.
Parameters:
  ch - the character to check true if the character is a token separator,false otherwise



isWhitespace
protected boolean isWhitespace(char ch)(Code)
Checks whether a character is a whitespace character. RFC 2616, section 2.2 defines space and horizontal tab as whitespace. The optional preceeding line break is irrelevant, since header continuation is handled transparently when parsing messages.
Parameters:
  ch - the character to check true if the character is whitespace,false otherwise



next
final public Object next() throws NoSuchElementException, ParseException(Code)
Returns the next token. Same as BasicTokenIterator.nextToken , but with generic return type. the next token in this iteration
throws:
  NoSuchElementException - if there are no more tokens
throws:
  ParseException - if an invalid header value is encountered



nextToken
public String nextToken() throws NoSuchElementException, ParseException(Code)
Obtains the next token from this iteration. the next token in this iteration
throws:
  NoSuchElementException - if the iteration is already over
throws:
  ParseException - if an invalid header value is encountered



remove
final public void remove() throws UnsupportedOperationException(Code)
Removing tokens is not supported.
throws:
  UnsupportedOperationException - always



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.