org.eclipse.webdav.http.client
Class Message

java.lang.Object
  extended by org.eclipse.webdav.http.client.Message
Direct Known Subclasses:
Request, Response

public abstract class Message
extends Object

A common superclass for HTTP messages. There are two kinds of HTTP message; requests and responses. They both have in common a context and an input stream. This class factors out these similarities.

Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Field Summary
protected static BufferPool bufferPool
           
protected  IContext context
           
protected  boolean hasInputStream
           
protected  boolean inputRead
           
protected  InputStream is
           
 
Constructor Summary
Message(IContext context, InputStream is)
          Creates a message.
 
Method Summary
 void close()
          Closes this message to free up any system resources.
 long getContentLength()
          Returns the content length of this message's body, or -1 if the content length is unknown.
 IContext getContext()
          Returns this message's context.
 InputStream getInputStream()
          Returns this message's input stream.
 String toString()
           
 void write(OutputStream os)
          Writes this messages body to the given output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bufferPool

protected static BufferPool bufferPool

is

protected InputStream is

inputRead

protected boolean inputRead

hasInputStream

protected boolean hasInputStream

context

protected IContext context
Constructor Detail

Message

public Message(IContext context,
               InputStream is)
Creates a message.

Parameters:
context - the message header, or null for an empty header
is - an input stream containing the message's body, or null for an empty body
Method Detail

close

public void close()
           throws IOException
Closes this message to free up any system resources. All messages must be closed before finalization.

Throws:
IOException - if there is an I/O error

getContentLength

public long getContentLength()
Returns the content length of this message's body, or -1 if the content length is unknown.

Returns:
the content length of this message's body

getContext

public IContext getContext()
Returns this message's context.

Returns:
this message's context

getInputStream

public InputStream getInputStream()
Returns this message's input stream.

Returns:
this message's input stream

toString

public String toString()
Overrides:
toString in class Object

write

public void write(OutputStream os)
           throws IOException
Writes this messages body to the given output stream. This method may only be called once during the lifetime of this message.

Parameters:
os - an output stream
Throws:
IOException - if there is an I/O error


Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.