Esri Geoportal Server
1.0

com.esri.gpt.framework.http
Class ByteArrayProvider

java.lang.Object
  extended by com.esri.gpt.framework.http.ContentBase
      extended by com.esri.gpt.framework.http.ContentProvider
          extended by com.esri.gpt.framework.http.ByteArrayProvider
Direct Known Subclasses:
StringProvider

public class ByteArrayProvider
extends ContentProvider

Byte array provider for the content of an HTTP request body.


Constructor Summary
ByteArrayProvider(byte[] content, String contentType)
          Constructs with an array of bytes and a content type.
 
Method Summary
 long getContentLength()
          Gets the content length (in bytes) to be provided in the HTTP request header.
 String getContentType()
          Gets the content type to be provided in the HTTP request header.
 boolean isRepeatable()
          Tests if the HTTP request content can be written to the output stream more than once.
 void writeRequest(HttpClientRequest request, OutputStream destination)
          Writes the content of the HTTP request body to an output stream.
 
Methods inherited from class com.esri.gpt.framework.http.ContentProvider
asBytes, ensureContentTypeEncoding, prepareForWrite
 
Methods inherited from class com.esri.gpt.framework.http.ContentBase
executeIO, executeIO, getInitialBufferlength, getLoggableContent, setInitialBufferLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayProvider

public ByteArrayProvider(byte[] content,
                         String contentType)
Constructs with an array of bytes and a content type.

Parameters:
content - the byte array providing the content for the HTTP request body
contentType - the content type of the HTTP request body, use null if unknown, include a charset if applicable, e.g. text/xml; charset=UTF-8
Method Detail

getContentLength

public long getContentLength()
Gets the content length (in bytes) to be provided in the HTTP request header.

Specified by:
getContentLength in class ContentProvider
Returns:
the request content length (in bytes, use -1 if unknown);

getContentType

public String getContentType()
Gets the content type to be provided in the HTTP request header.
Include a charset if applicable, e.g. text/xml; charset=UTF-8

Specified by:
getContentType in class ContentProvider
Returns:
the request content type

isRepeatable

public boolean isRepeatable()
Tests if the HTTP request content can be written to the output stream more than once.

Specified by:
isRepeatable in class ContentProvider
Returns:
always true

writeRequest

public void writeRequest(HttpClientRequest request,
                         OutputStream destination)
                  throws IOException
Writes the content of the HTTP request body to an output stream.

Specified by:
writeRequest in class ContentProvider
Parameters:
request - the HTTP request that is executing
destination - the output stream to which data will be written
Throws:
IOException - if an exception occurs

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.