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:
java.io.Closeable

public class SizeLimitedInputStream
extends java.io.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(java.io.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(java.io.InputStream wrappedInputStream,
                              int maxBytesToRead)
Method Detail

read

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

skip

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

close

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

available

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

mark

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

reset

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

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream


Copyright © 2003-2010 Atlassian. All Rights Reserved.