Java Doc for HttpInputStream.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) 


java.lang.Object
   java.io.InputStream
      java.io.FilterInputStream
         sunlabs.brazil.util.http.HttpInputStream

HttpInputStream
public class HttpInputStream extends FilterInputStream (Code)
This class is an input stream that provides added methods that are of help when reading the result of an HTTP request. By setting up this input stream, the user can conveniently read lines of text and copy the contents of an input stream to an output stream.

The underlying assumption of this class is that when reading the result of an HTTP request, each byte in the input stream represents an 8-bit ASCII character, and as such, it is perfectly valid to treat each byte as a character. Locale-based conversion is not appropriate in this circumstance, so the java.io.BufferedReader.readLine method should not be used.
author:
   Colin Stevens (colin.stevens@sun.com)
version:
   1.7, 00/03/29



Field Summary
public static  intdefaultBufsize
     The default size of the temporary buffer used when copying from an input stream to an output stream.

Constructor Summary
public  HttpInputStream(InputStream in)
     Creates a new HttpInputStream that reads its input from the specified input stream.

Method Summary
public  intcopyTo(OutputStream out)
     Copies bytes from this input stream to the specified output stream until end of the input stream is reached.
Parameters:
  out - The output stream to copy the data to. The number of bytes copied to the output stream.
throws:
  IOException - if the underlying input stream throws anIOException while being read or if the output streamthrows an IOException while being written.
public  intcopyTo(OutputStream out, int len)
     Copies bytes from this input stream to the specified output stream until the specified number of bytes are copied or the end of the input stream is reached.
Parameters:
  out - The output stream to copy the data to.
Parameters:
  len - The number of bytes to copy, or < 0 to copy until the endof this stream. The number of bytes copied to the output stream.
throws:
  IOException - if the underlying input stream throws anIOException while being read or if the output streamthrows an IOException while being written.
public  intcopyTo(OutputStream out, int len, byte[] buf)
     Copies bytes from this input stream to the specified output stream until the specified number of bytes are copied or the end of the input stream is reached.
Parameters:
  out - The output stream to copy the data to.
Parameters:
  len - The number of bytes to copy, or < 0 to copy until the endof this stream.
Parameters:
  buf - The buffer used to for holding the temporary results whilecopying data from this input stream to the output stream.May be null to allow this method copy inchunks of length defaultBufsize. The number of bytes copied to the output stream.
throws:
  IOException - if the underlying input stream throws anIOException while being read or if the output streamthrows an IOException while being written.
public  intreadFully(byte[] buf)
     Reads buf.length bytes from the input stream.
public  intreadFully(byte[] buf, int off, int len)
     Reads the specified number of bytes from the input stream.
public  StringreadLine()
     Reads the next line of text from the input stream.

A line is terminated by "\r", "\n", "\r\n", or the end of the input stream.

public  StringreadLine(int limit)
     Reads the next line of text from the input stream, up to the limit specified.

A line is terminated by "\r", "\n", "\r\n", the end of the input stream, or when the specified number of characters have been read. The line-terminating characters are discarded.


Field Detail
defaultBufsize
public static int defaultBufsize(Code)
The default size of the temporary buffer used when copying from an input stream to an output stream.
See Also:   HttpInputStream.copyTo(OutputStream,int,byte[])




Constructor Detail
HttpInputStream
public HttpInputStream(InputStream in)(Code)
Creates a new HttpInputStream that reads its input from the specified input stream.
Parameters:
  in - The underlying input stream.




Method Detail
copyTo
public int copyTo(OutputStream out) throws IOException(Code)
Copies bytes from this input stream to the specified output stream until end of the input stream is reached.
Parameters:
  out - The output stream to copy the data to. The number of bytes copied to the output stream.
throws:
  IOException - if the underlying input stream throws anIOException while being read or if the output streamthrows an IOException while being written. It may not bepossible to distinguish amongst the two conditions.



copyTo
public int copyTo(OutputStream out, int len) throws IOException(Code)
Copies bytes from this input stream to the specified output stream until the specified number of bytes are copied or the end of the input stream is reached.
Parameters:
  out - The output stream to copy the data to.
Parameters:
  len - The number of bytes to copy, or < 0 to copy until the endof this stream. The number of bytes copied to the output stream.
throws:
  IOException - if the underlying input stream throws anIOException while being read or if the output streamthrows an IOException while being written. It may not bepossible to distinguish amongst the two conditions.



copyTo
public int copyTo(OutputStream out, int len, byte[] buf) throws IOException(Code)
Copies bytes from this input stream to the specified output stream until the specified number of bytes are copied or the end of the input stream is reached.
Parameters:
  out - The output stream to copy the data to.
Parameters:
  len - The number of bytes to copy, or < 0 to copy until the endof this stream.
Parameters:
  buf - The buffer used to for holding the temporary results whilecopying data from this input stream to the output stream.May be null to allow this method copy inchunks of length defaultBufsize. The number of bytes copied to the output stream.
throws:
  IOException - if the underlying input stream throws anIOException while being read or if the output streamthrows an IOException while being written. It may not bepossible to distinguish amongst the two conditions.



readFully
public int readFully(byte[] buf) throws IOException(Code)
Reads buf.length bytes from the input stream. This method reads repeatedly from the input stream until the specified number of bytes have been read or the end of the input stream is reached.

The standard InputStream.read method will generally return less than the specified number of bytes if the underlying input stream is "bursty", such as from a network source. Sometimes it is important to read the exact number of bytes desired.
Parameters:
  buf - Buffer in which the data is stored. If buffer is oflength 0, this method will return immediately. The number of bytes read. This will be less thanbuf.length if the end of the input stream wasreached.
throws:
  IOException - if the underlying input stream throws anIOException while being read.




readFully
public int readFully(byte[] buf, int off, int len) throws IOException(Code)
Reads the specified number of bytes from the input stream. This method reads repeatedly from the input stream until the specified number of bytes have been read or the end of the input stream is reached.

The standard InputStream.read method will generally return less than the specified number of bytes if the underlying input stream is "bursty", such as from a network source. Sometimes it is important to read the exact number of bytes desired.
Parameters:
  buf - Buffer in which the data is stored.
Parameters:
  off - The starting offset into the buffer.
Parameters:
  len - The number of bytes to read. The number of bytes read. This will be less thanlen if the end of the input stream was reached.
throws:
  IOException - if the underlying input stream throws anIOException while being read.




readLine
public String readLine() throws IOException(Code)
Reads the next line of text from the input stream.

A line is terminated by "\r", "\n", "\r\n", or the end of the input stream. The line-terminating characters are discarded. The next line from the input stream, or nullif the end of the input stream is reached and no byteswere found.
throws:
  IOException - if the underlying input stream throws anIOException while being read.




readLine
public String readLine(int limit) throws IOException(Code)
Reads the next line of text from the input stream, up to the limit specified.

A line is terminated by "\r", "\n", "\r\n", the end of the input stream, or when the specified number of characters have been read. The line-terminating characters are discarded. It is not possible to distinguish, based on the result, between a line that was exactly limit characters long and a line that was terminated because limit characters were read. The next line from the input stream, or nullif the end of the input stream is reached and no byteswere found.
throws:
  IOException - if the underlying input stream throws anIOException while being read.




Fields inherited from java.io.FilterInputStream
protected volatile InputStream in(Code)(Java Doc)

Methods inherited from java.io.FilterInputStream
public int available() throws IOException(Code)(Java Doc)
public void close() throws IOException(Code)(Java Doc)
public synchronized void mark(int readlimit)(Code)(Java Doc)
public boolean markSupported()(Code)(Java Doc)
public int read() throws IOException(Code)(Java Doc)
public int read(byte b) throws IOException(Code)(Java Doc)
public int read(byte b, int off, int len) throws IOException(Code)(Java Doc)
public synchronized void reset() throws IOException(Code)(Java Doc)
public long skip(long n) throws IOException(Code)(Java Doc)

Methods inherited from java.io.InputStream
public int available() throws IOException(Code)(Java Doc)
public void close() throws IOException(Code)(Java Doc)
public synchronized void mark(int readlimit)(Code)(Java Doc)
public boolean markSupported()(Code)(Java Doc)
abstract public int read() throws IOException(Code)(Java Doc)
public int read(byte b) throws IOException(Code)(Java Doc)
public int read(byte b, int off, int len) throws IOException(Code)(Java Doc)
public synchronized void reset() throws IOException(Code)(Java Doc)
public long skip(long n) throws IOException(Code)(Java Doc)

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.