com.atlassian.confluence.util.http
Class SizeLimitedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.atlassian.confluence.util.http.SizeLimitedInputStream
All Implemented Interfaces:
Closeable

public class SizeLimitedInputStream
extends InputStream

This is a wrapper around an InputStream that limits the amount of data that can be returned. This allows admins to set maximum download sizes for Confluence retrieved content, so that people can't, say, point the RSS macro at an ISO file and cause the system to collapse painfully. If you try to retrieve more than the maximum allowed size, the read() methods will fail with an IOException


Constructor Summary
SizeLimitedInputStream(InputStream wrappedInputStream, int maxBytesToRead)
           
 
Method Summary
 int available()
           
 void close()
           
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.io.InputStream
read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeLimitedInputStream

public SizeLimitedInputStream(InputStream wrappedInputStream,
                              int maxBytesToRead)
Method Detail

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class InputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

available

public int available()
              throws IOException
Overrides:
available in class InputStream
Throws:
IOException

mark

public void mark(int readlimit)
Overrides:
mark in class InputStream

reset

public void reset()
           throws IOException
Overrides:
reset in class InputStream
Throws:
IOException

markSupported

public boolean markSupported()
Overrides:
markSupported in class InputStream


Copyright © 2003-2011 Atlassian. All Rights Reserved.