Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * #%L
  * wcm.io
  * %%
  * Copyright (C) 2014 wcm.io
  * %%
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package io.wcm.caravan.io.http.response;
Generic HTTP body.
public interface Body extends Closeable {

  
length in bytes, if known. Null if not.


Note
This is an integer as most implementations cannot do bodies greater than 2GB. Moreover, the scope of this interface doesn't include large bodies.

Returns:
Length of the body
  Integer length();

  
True if asInputStream() and asReader() can be called more than once.

Returns:
True if repeatable
  boolean isRepeatable();

  
It is the responsibility of the caller to close the stream.

Returns:
Stream representation
Throws:
java.io.IOException Error generating Stream
It is the responsibility of the caller to close the stream.

Returns:
Reader representation
Throws:
java.io.IOException Error generating Reader
  Reader asReader() throws IOException;

  
Returns body as string and closes the stream.

Returns:
String representation
Throws:
java.io.IOException Error generating String
  String asString() throws IOException;
New to GrepCode? Check out our FAQ X