Java Doc for MimeHeaders.java in  » Web-Server » Brazil » sunlabs » brazil » util » http » 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 » Web Server » Brazil » sunlabs.brazil.util.http 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


sunlabs.brazil.util.StringMap
   sunlabs.brazil.util.http.MimeHeaders

MimeHeaders
public class MimeHeaders extends StringMap (Code)
This class is build on top of the StringMap class and provides added methods that are of help when manipulating MIME headers. By creating an instance of this class, the user can conveniently read, write, and modify MIME headers.
author:
   Colin Stevens (colin.stevens@sun.com)
version:
   1.12 99/11/16



Constructor Summary
public  MimeHeaders()
     Creates a new, empty MimeHeaders object.
public  MimeHeaders(HttpInputStream in)
     Creates a new MimeHeaders object and then initializes it by reading MIME headers from the specified input stream.

Method Summary
public  voidadd(String key, int value)
     Adds a mapping for the given case-insensitive key to the specified value in this MimeHeaders object.
public  voidcopyTo(MimeHeaders other)
     Copies the contents of this MimeHeaders object, MimeHeaders.add adding all the other's keys and values to the other.
public  voidprint(OutputStream out)
     Writes this MimeHeaders object to the given output stream.
public  voidprint(PrintStream out)
     Writes this MimeHeaders object to the given output stream.
public  voidput(String key, int value)
     Maps the given case-insensitive key to the specified value in this MimeHeaders object, replacing the old value.

This is convenience method that automatically converts the integer value to a string before calling the underlying put method.
Parameters:
  key - The new key.

public  voidputIfNotPresent(String key, String value)
     Maps the given case-insensitive key to the specified value if the key does not already exist in this MimeHeaders object.

Often, when dealing with MIME headers, the user will want to set a header only if that header is not already set.

public  voidread(HttpInputStream in)
     Reads MIME headers from the specified input stream.


Constructor Detail
MimeHeaders
public MimeHeaders()(Code)
Creates a new, empty MimeHeaders object.



MimeHeaders
public MimeHeaders(HttpInputStream in) throws IOException(Code)
Creates a new MimeHeaders object and then initializes it by reading MIME headers from the specified input stream.
Parameters:
  in - The input stream to read.




Method Detail
add
public void add(String key, int value)(Code)
Adds a mapping for the given case-insensitive key to the specified value in this MimeHeaders object. It leaves any existing key-value mapping alone.

This is convenience method that automatically converts the integer value to a string before calling the underlying add method.
Parameters:
  key - The new key. May not be null.
Parameters:
  value - The new value.




copyTo
public void copyTo(MimeHeaders other)(Code)
Copies the contents of this MimeHeaders object, MimeHeaders.add adding all the other's keys and values to the other.
Parameters:
  other - The MimeHeaders object to copy to.



print
public void print(OutputStream out)(Code)
Writes this MimeHeaders object to the given output stream. This method does not write a blank line after the headers are written.
Parameters:
  out - The output stream.



print
public void print(PrintStream out)(Code)
Writes this MimeHeaders object to the given output stream. This method does not write a blank line after the headers are written.
Parameters:
  out - The output stream.



put
public void put(String key, int value)(Code)
Maps the given case-insensitive key to the specified value in this MimeHeaders object, replacing the old value.

This is convenience method that automatically converts the integer value to a string before calling the underlying put method.
Parameters:
  key - The new key. May not be null.
Parameters:
  value - The new value.




putIfNotPresent
public void putIfNotPresent(String key, String value)(Code)
Maps the given case-insensitive key to the specified value if the key does not already exist in this MimeHeaders object.

Often, when dealing with MIME headers, the user will want to set a header only if that header is not already set.
Parameters:
  key - The new key. May not be null.
Parameters:
  value - The new value. May be null.




read
public void read(HttpInputStream in) throws IOException(Code)
Reads MIME headers from the specified input stream. This method reads up to and consumes the blank line that marks the end of the MIME headers. It also stops reading if it reaches the end of the input stream.

The MIME headers read from the input stream are stored in this MimeHeaders object. All headers read are added to the existing headers; the new headers do not replace the existing ones. The order of the headers in this object will reflect the order of the headers from the input stream, but space characters surrounding the keys and values are not preserved.

In a set of MIME headers, the given key may appear multiple times (that is, on multiple lines, not necessarily consecutively). In that case, that key will appear multiple times in this MimeHeaders object also. The HTTP spec says that if a given key appears multiple times in a set of MIME headers, the values can be concatenated together with commas between them. However, in practice, it appears that some browsers and HTTP servers get confused when encountering such collapsed MIME headers, for instance, the Yahoo mail reader program.

MIME headers also support the idea of continuation lines, where a key (and optionally its value) is followed on subsequent line(s) by another value without a key. The HTTP spec says that in this case the values can be concatenated together with space characters between them. In practice, joining continuation lines together does not seem to confuse any browsers or HTTP servers. This method joins continuation lines together by putting the space-equivalent characters "\r\n\t" between the values so it can be easily parsed with StringTokenizer and also easily written to an output stream in a format that actually preserves its formatting as a continuation line.
Parameters:
  in - The input stream to read from.
throws:
  IOException - if the input stream throws an IOException while beingread.




Methods inherited from sunlabs.brazil.util.StringMap
public void add(String key, String value)(Code)(Java Doc)
public void clear()(Code)(Java Doc)
public Enumeration elements()(Code)(Java Doc)
public String get(int index) throws IndexOutOfBoundsException(Code)(Java Doc)
public String get(String key)(Code)(Java Doc)
public Object get(Object key)(Code)(Java Doc)
public String getKey(int index) throws IndexOutOfBoundsException(Code)(Java Doc)
public boolean isEmpty()(Code)(Java Doc)
public Enumeration keys()(Code)(Java Doc)
public void put(int index, String value)(Code)(Java Doc)
public void put(String key, String value)(Code)(Java Doc)
public Object put(Object key, Object value)(Code)(Java Doc)
public void remove(String key)(Code)(Java Doc)
public void remove(int i)(Code)(Java Doc)
public Object remove(Object key)(Code)(Java Doc)
public int size()(Code)(Java Doc)
public String toString()(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.