gnu.inet.http
Class ByteArrayRequestBodyWriter

java.lang.Object
  extended by gnu.inet.http.ByteArrayRequestBodyWriter
All Implemented Interfaces:
RequestBodyWriter

public class ByteArrayRequestBodyWriter
extends java.lang.Object
implements RequestBodyWriter

A simple request body writer using a byte array.

Author:
Chris Burdess

Field Summary
protected  byte[] content
          The content.
protected  int pos
          The position within the content at which the next read will occur.
 
Constructor Summary
ByteArrayRequestBodyWriter(byte[] content)
          Constructs a new byte array request body writer with the specified content.
 
Method Summary
 int getContentLength()
          Returns the total number of bytes that will be written in a single pass by this writer.
 void reset()
          Initialises the writer.
 int write(byte[] buffer)
          Writes body content to the supplied buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

content

protected byte[] content
The content.


pos

protected int pos
The position within the content at which the next read will occur.

Constructor Detail

ByteArrayRequestBodyWriter

public ByteArrayRequestBodyWriter(byte[] content)
Constructs a new byte array request body writer with the specified content.

Parameters:
content - the content buffer
Method Detail

getContentLength

public int getContentLength()
Returns the total number of bytes that will be written in a single pass by this writer.

Specified by:
getContentLength in interface RequestBodyWriter

reset

public void reset()
Initialises the writer. This will be called before each pass.

Specified by:
reset in interface RequestBodyWriter

write

public int write(byte[] buffer)
Writes body content to the supplied buffer.

Specified by:
write in interface RequestBodyWriter
Parameters:
buffer - the content buffer
Returns:
the number of bytes written


© Copyright 2003 The Free Software Foundation, all rights reserved