com.wewebu.ow.server.util.upload
Class OwBufferedServletInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by javax.servlet.ServletInputStream
          extended by com.wewebu.ow.server.util.upload.OwBufferedServletInputStream
All Implemented Interfaces:
Closeable

public class OwBufferedServletInputStream
extends javax.servlet.ServletInputStream

A BufferedServletInputStream wraps a ServletInputStream in order to provide input buffering and to avoid calling the the readLine method of the wrapped ServletInputStream.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Constructor Summary
OwBufferedServletInputStream(javax.servlet.ServletInputStream in_p)
          Creates a BufferedServletInputStream that wraps ServletInputStream.
 
Method Summary
 void close()
          close the wrapped stream
 int read()
          Implement buffering read method of the wrapped ServletInputStream.
 int read(byte[] b_p, int off_p, int len_p)
          Implement buffering read method of the wrapped ServletInputStream.
 int readLine(byte[] b_p, int off_p, int len_p)
          Implement buffering readLine method of the wrapped ServletInputStream.
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwBufferedServletInputStream

public OwBufferedServletInputStream(javax.servlet.ServletInputStream in_p)
Creates a BufferedServletInputStream that wraps ServletInputStream.

Parameters:
in_p - a servlet input stream.
Method Detail

readLine

public int readLine(byte[] b_p,
                    int off_p,
                    int len_p)
             throws IOException
Implement buffering readLine method of the wrapped ServletInputStream.

Overrides:
readLine in class javax.servlet.ServletInputStream
Parameters:
b_p - an array of bytes into which data is read.
off_p - an integer specifying the character at which this method begins reading.
len_p - an integer specifying the maximum number of bytes to read.
Returns:
an integer specifying the actual number of bytes read, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error occurs.

read

public int read()
         throws IOException
Implement buffering read method of the wrapped ServletInputStream.

Specified by:
read in class InputStream
Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error occurs.

read

public int read(byte[] b_p,
                int off_p,
                int len_p)
         throws IOException
Implement buffering read method of the wrapped ServletInputStream.

Overrides:
read in class InputStream
Parameters:
b_p - the buffer into which the data is read.
off_p - the start offset of the data.
len_p - the maximum number of bytes read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Throws:
IOException - if an I/O error occurs.

close

public void close()
           throws IOException
close the wrapped stream

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException
See Also:
InputStream.close()


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.