Coverage Report - org.apache.commons.messagelet.impl.BufferedServletInputStream
 
Classes in this File Line Coverage Branch Coverage Complexity
BufferedServletInputStream
0%
0/25
N/A
1
 
 1  
 /*
 2  
  * Copyright (C) The Apache Software Foundation. All rights reserved.
 3  
  *
 4  
  * This software is published under the terms of the Apache Software License
 5  
  * version 1.1, a copy of which has been included with this distribution in
 6  
  * the LICENSE file.
 7  
  * 
 8  
  * $Id: BufferedServletInputStream.java 155459 2005-02-26 13:24:44Z dirkv $
 9  
  */
 10  
 package org.apache.commons.messagelet.impl;
 11  
 
 12  
 import java.io.ByteArrayInputStream;
 13  
 import java.io.IOException;
 14  
 import java.io.InputStream;
 15  
 
 16  
 import javax.servlet.ServletInputStream;
 17  
 
 18  
 /** 
 19  
  * <p><code>BufferedServletInputStream</code> implements
 20  
  * a ServletInputStream using an underlying InputStream.</p>
 21  
  *
 22  
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 23  
   * @version $Revision: 155459 $
 24  
  */
 25  
 public class BufferedServletInputStream extends ServletInputStream {
 26  
     
 27  0
     protected static final byte[] NO_DATA = new byte[0];
 28  
     
 29  
     /** The underlying <code>InputStream</code> */
 30  
     private InputStream in;
 31  
     
 32  
     
 33  0
     public BufferedServletInputStream() {
 34  0
         this.in = new ByteArrayInputStream( NO_DATA );
 35  0
     }
 36  
     
 37  0
     public BufferedServletInputStream(InputStream in) {
 38  0
         this.in = in;
 39  0
     }
 40  
     
 41  0
     public BufferedServletInputStream(String text) {
 42  0
         in = new ByteArrayInputStream( text.getBytes() );
 43  0
     }
 44  
     
 45  0
     public BufferedServletInputStream(byte[] data) {
 46  0
         in = new ByteArrayInputStream(data);
 47  0
     }
 48  
     
 49  
     // Delegating methods from InputStream
 50  
     //-------------------------------------------------------------------------    
 51  
     
 52  
     public int available() throws IOException {
 53  0
         return in.available();
 54  
     }    
 55  
     
 56  
     public void close() throws IOException {
 57  0
         in.close();
 58  0
     }
 59  
     
 60  
     public void mark(int readlimit) {
 61  0
         in.mark(readlimit);
 62  0
     }
 63  
     
 64  
     public boolean markSupported() {
 65  0
         return in.markSupported();
 66  
     }
 67  
     
 68  
     public int read(byte[] b) throws IOException {
 69  0
         return in.read(b);
 70  
     }
 71  
     
 72  
     public int read(byte[] b, int off, int len) throws IOException {
 73  0
         return in.read(b, off, len);
 74  
     }
 75  
     
 76  
     public int read() throws IOException {
 77  0
         return in.read();
 78  
     }
 79  
         
 80  
     public void reset() throws IOException {
 81  0
         in.reset();
 82  0
     }    
 83  
     
 84  
     public long skip(long n) throws IOException {
 85  0
         return in.skip(n);
 86  
     }    
 87  
 }