Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 12397D838 for ; Tue, 28 May 2013 07:24:17 +0000 (UTC) Received: (qmail 81098 invoked by uid 500); 28 May 2013 07:24:11 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 79602 invoked by uid 500); 28 May 2013 07:24:05 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 79268 invoked by uid 99); 28 May 2013 07:24:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 May 2013 07:24:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 May 2013 07:23:34 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B160F2388C7E; Tue, 28 May 2013 07:21:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1486787 [39/40] - in /chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings: ./ css/ images/ images/logos/ xref-test/ xref-test/org/ xref-test/org/apache/ xref-test/org/apache/chemistry/... Date: Tue, 28 May 2013 07:21:44 -0000 To: commits@chemistry.apache.org From: gabriele@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130528072151.B160F2388C7E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.html Tue May 28 07:21:41 2013 @@ -0,0 +1,620 @@ + + + + +ThresholdOutputStream xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.shared;
+20  
+21  import java.io.BufferedInputStream;
+22  import java.io.BufferedOutputStream;
+23  import java.io.File;
+24  import java.io.FileInputStream;
+25  import java.io.FileNotFoundException;
+26  import java.io.FileOutputStream;
+27  import java.io.IOException;
+28  import java.io.InputStream;
+29  import java.io.OutputStream;
+30  import java.security.Key;
+31  
+32  import javax.crypto.Cipher;
+33  import javax.crypto.CipherInputStream;
+34  import javax.crypto.CipherOutputStream;
+35  import javax.crypto.KeyGenerator;
+36  import javax.crypto.spec.IvParameterSpec;
+37  
+38  import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
+39  import org.slf4j.Logger;
+40  import org.slf4j.LoggerFactory;
+41  
+42  /**
+43   * An OutputStream that stores the data in main memory until it reaches a
+44   * threshold. If the threshold is passed the data is written to a temporary
+45   * file.
+46   * 
+47   * It it is important to close this OutputStream before
+48   * {@link #getInputStream()} is called or call {@link #destroy()} if the
+49   * InputStream isn't required!
+50   */
+51  public class ThresholdOutputStream extends OutputStream {
+52  
+53      private static final Logger LOG = LoggerFactory.getLogger(ThresholdOutputStream.class);
+54  
+55      private static final int MAX_GROW = 10 * 1024 * 1024; // 10 MiB
+56      private static final int DEFAULT_THRESHOLD = 4 * 1024 * 1024; // 4 MiB
+57  
+58      private static final String ALGORITHM = "AES";
+59      private static final String MODE = "CTR";
+60      private static final String PADDING = "PKCS5Padding";
+61      private static final String TRANSFORMATION = ALGORITHM + '/' + MODE + '/' + PADDING;
+62      private static final int KEY_SIZE = 128;
+63  
+64      private final File tempDir;
+65      private final int memoryThreshold;
+66      private final long maxContentSize;
+67      private final boolean encrypt;
+68  
+69      private byte[] buf = null;
+70      private int bufSize = 0;
+71      private long size = 0;
+72      private File tempFile;
+73      private OutputStream tmpStream;
+74      private Key key;
+75      private byte[] iv;
+76  
+77      /**
+78       * Constructor.
+79       * 
+80       * @param tempDir
+81       *            temp directory or <code>null</code> for the default temp
+82       *            directory
+83       * @param memoryThreshold
+84       *            memory threshold in bytes
+85       * @param maxContentSize
+86       *            max size of the content in bytes (-1 to disable the check)
+87       */
+88      public ThresholdOutputStream(File tempDir, int memoryThreshold, long maxContentSize) {
+89          this(64 * 1024, tempDir, memoryThreshold, maxContentSize, false);
+90      }
+91  
+92      /**
+93       * Constructor.
+94       * 
+95       * @param tempDir
+96       *            temp directory or <code>null</code> for the default temp
+97       *            directory
+98       * @param memoryThreshold
+99       *            memory threshold in bytes
+100      * @param maxContentSize
+101      *            max size of the content in bytes (-1 to disable the check)
+102      */
+103     public ThresholdOutputStream(File tempDir, int memoryThreshold, long maxContentSize, boolean encrypt) {
+104         this(64 * 1024, tempDir, memoryThreshold, maxContentSize, encrypt);
+105     }
+106 
+107     /**
+108      * Constructor.
+109      * 
+110      * @param initSize
+111      *            initial internal buffer size
+112      * @param tempDir
+113      *            temp directory or <code>null</code> for the default temp
+114      *            directory
+115      * @param memoryThreshold
+116      *            memory threshold in bytes
+117      * @param maxContentSize
+118      *            max size of the content in bytes (-1 to disable the check)
+119      * @param encrypt
+120      *            indicates if temporary files must be encrypted
+121      */
+122     public ThresholdOutputStream(int initSize, File tempDir, int memoryThreshold, long maxContentSize, boolean encrypt) {
+123         if (initSize < 0) {
+124             throw new IllegalArgumentException("Negative initial size: " + initSize);
+125         }
+126 
+127         this.tempDir = tempDir;
+128         this.memoryThreshold = (memoryThreshold < 0 ? DEFAULT_THRESHOLD : memoryThreshold);
+129         this.maxContentSize = maxContentSize;
+130         this.encrypt = encrypt;
+131 
+132         buf = new byte[initSize];
+133     }
+134 
+135     private void expand(int nextBufferSize) throws IOException {
+136         if (bufSize + nextBufferSize <= buf.length) {
+137             return;
+138         }
+139 
+140         if (bufSize + nextBufferSize > memoryThreshold) {
+141             if (tmpStream == null) {
+142                 tempFile = File.createTempFile("opencmis", null, tempDir);
+143                 if (encrypt) {
+144 
+145                     Cipher cipher;
+146                     try {
+147                         KeyGenerator keyGenerator = KeyGenerator.getInstance(ALGORITHM);
+148                         keyGenerator.init(KEY_SIZE);
+149                         key = keyGenerator.generateKey();
+150 
+151                         cipher = Cipher.getInstance(TRANSFORMATION);
+152                         cipher.init(Cipher.ENCRYPT_MODE, key);
+153 
+154                         iv = cipher.getIV();
+155                     } catch (Exception e) {
+156                         throw new IOException("Cannot initialize encryption cipher!", e);
+157                     }
+158 
+159                     tmpStream = new BufferedOutputStream(new CipherOutputStream(new FileOutputStream(tempFile), cipher));
+160                 } else {
+161                     tmpStream = new BufferedOutputStream(new FileOutputStream(tempFile));
+162                 }
+163             }
+164             tmpStream.write(buf, 0, bufSize);
+165 
+166             if (buf.length != memoryThreshold) {
+167                 buf = new byte[memoryThreshold];
+168             }
+169             bufSize = 0;
+170 
+171             return;
+172         }
+173 
+174         int newSize = ((bufSize + nextBufferSize) * 2 < MAX_GROW ? (bufSize + nextBufferSize) * 2 : buf.length
+175                 + nextBufferSize + MAX_GROW);
+176         byte[] newbuf = new byte[newSize];
+177         System.arraycopy(buf, 0, newbuf, 0, bufSize);
+178         buf = newbuf;
+179     }
+180 
+181     public long getSize() {
+182         return size;
+183     }
+184 
+185     @Override
+186     public void write(byte[] buffer) throws IOException {
+187         write(buffer, 0, buffer.length);
+188     }
+189 
+190     @Override
+191     public void write(byte[] buffer, int offset, int len) throws IOException {
+192         try {
+193             if (len == 0) {
+194                 return;
+195             }
+196 
+197             if ((maxContentSize > -1) && (size + len > maxContentSize)) {
+198                 destroy();
+199                 throw new CmisConstraintException("Content too big!");
+200             }
+201 
+202             expand(len);
+203             System.arraycopy(buffer, offset, buf, bufSize, len);
+204             bufSize += len;
+205             size += len;
+206         } catch (IOException ioe) {
+207             destroy();
+208             throw ioe;
+209         }
+210     }
+211 
+212     @Override
+213     public void write(int oneByte) throws IOException {
+214         try {
+215             if ((maxContentSize > -1) && (size + 1 > maxContentSize)) {
+216                 destroy();
+217                 throw new CmisConstraintException("Content too big!");
+218             }
+219 
+220             if (bufSize == buf.length) {
+221                 expand(1);
+222             }
+223 
+224             buf[bufSize++] = (byte) oneByte;
+225             size++;
+226         } catch (IOException ioe) {
+227             destroy();
+228             throw ioe;
+229         }
+230     }
+231 
+232     @Override
+233     public void flush() throws IOException {
+234         if (tmpStream != null) {
+235             try {
+236                 if (bufSize > 0) {
+237                     tmpStream.write(buf, 0, bufSize);
+238                     bufSize = 0;
+239                 }
+240                 tmpStream.flush();
+241             } catch (IOException ioe) {
+242                 destroy();
+243                 throw ioe;
+244             }
+245         }
+246     }
+247 
+248     @Override
+249     public void close() throws IOException {
+250         flush();
+251 
+252         if (tmpStream != null) {
+253             tmpStream.close();
+254         }
+255     }
+256 
+257     /**
+258      * Destroys the object before it has been read.
+259      */
+260     public void destroy() {
+261         try {
+262             if (tmpStream != null) {
+263                 tmpStream.flush();
+264                 tmpStream.close();
+265             }
+266         } catch (Exception e) {
+267             // ignore
+268         }
+269 
+270         if (tempFile != null) {
+271             boolean isDeleted = tempFile.delete();
+272             if (!isDeleted) {
+273                 LOG.warn("Temp file " + tempFile.getAbsolutePath() + " could not be deleted!");
+274             }
+275         }
+276 
+277         buf = null;
+278     }
+279 
+280     /**
+281      * Returns the data as an InputStream.
+282      */
+283     public InputStream getInputStream() throws IOException {
+284         if (tmpStream != null) {
+285             close();
+286             buf = null;
+287 
+288             return new InternalTempFileInputStream();
+289         } else {
+290             return new InternalBufferInputStream();
+291         }
+292     }
+293 
+294     /**
+295      * Provides information about the input stream.
+296      */
+297     public abstract class ThresholdInputStream extends InputStream {
+298 
+299         /**
+300          * Returns if the data is stored in memory.
+301          * 
+302          * @return <code>true</code> if the data is in memory and
+303          *         <code>false</code> if the data resides in a temporary file
+304          */
+305         public abstract boolean isInMemory();
+306 
+307         /**
+308          * Gets the temporary file.
+309          * 
+310          * @return the temporary file or <code>null</code> if the data is stored
+311          *         in memory
+312          */
+313         public File getTemporaryFile() {
+314             return null;
+315         }
+316 
+317         /**
+318          * Gets the byte buffer.
+319          * 
+320          * @return the content in a byte array or <code>null</code> if the data
+321          *         is stored in a file
+322          */
+323         public byte[] getBytes() {
+324             return null;
+325         }
+326 
+327         /**
+328          * Returns the length of the stream.
+329          * 
+330          * @return the length of the stream in bytes
+331          */
+332         public long length() {
+333             return size;
+334         }
+335 
+336         /**
+337          * Rewinds the stream so that it can be read from the beginning.
+338          */
+339         public abstract void rewind() throws IOException;
+340     }
+341 
+342     /**
+343      * InputStream for in-memory data.
+344      */
+345     private class InternalBufferInputStream extends ThresholdInputStream {
+346 
+347         private int pos = 0;
+348         private int mark = -1;
+349 
+350         public boolean isInMemory() {
+351             return true;
+352         }
+353 
+354         public byte[] getBytes() {
+355             return buf;
+356         }
+357 
+358         @Override
+359         public void rewind() throws IOException {
+360             if (buf == null) {
+361                 throw new IOException("Stream is already closed!");
+362             }
+363 
+364             pos = 0;
+365             mark = -1;
+366         }
+367 
+368         @Override
+369         public boolean markSupported() {
+370             return true;
+371         }
+372 
+373         @Override
+374         public synchronized void mark(int readlimit) {
+375             if (buf != null) {
+376                 mark = pos;
+377             }
+378         }
+379 
+380         @Override
+381         public synchronized void reset() throws IOException {
+382             if (mark < 0) {
+383                 throw new IOException("Reset not possible.");
+384             }
+385 
+386             pos = mark;
+387         }
+388 
+389         @Override
+390         public int available() {
+391             if (buf == null) {
+392                 return 0;
+393             }
+394 
+395             return bufSize - pos;
+396         }
+397 
+398         @Override
+399         public int read() {
+400             return (pos < bufSize) && (buf != null) ? (buf[pos++] & 0xff) : -1;
+401         }
+402 
+403         @Override
+404         public int read(byte[] b) throws IOException {
+405             return read(b, 0, b.length);
+406         }
+407 
+408         @Override
+409         public int read(byte[] b, int off, int len) {
+410             if ((pos >= bufSize) || (buf == null)) {
+411                 return -1;
+412             }
+413 
+414             if (len == 0) {
+415                 return 0;
+416             }
+417 
+418             if ((pos + len) > bufSize) {
+419                 len = (bufSize - pos);
+420             }
+421 
+422             System.arraycopy(buf, pos, b, off, len);
+423             pos += len;
+424 
+425             return len;
+426         }
+427 
+428         @Override
+429         public long skip(long n) {
+430             if (buf == null) {
+431                 return -1;
+432             }
+433 
+434             if (n <= 0) {
+435                 return 0;
+436             }
+437 
+438             if ((pos + n) > bufSize) {
+439                 n = bufSize - pos;
+440             }
+441 
+442             pos += n;
+443 
+444             return n;
+445         }
+446 
+447         @Override
+448         public void close() throws IOException {
+449             buf = null;
+450             mark = -1;
+451         }
+452     }
+453 
+454     /**
+455      * InputStream for file data.
+456      */
+457     private class InternalTempFileInputStream extends ThresholdInputStream {
+458 
+459         private final Cipher cipher;
+460         private BufferedInputStream stream;
+461         private boolean isDeleted = false;
+462         private boolean isClosed = false;
+463 
+464         public InternalTempFileInputStream() throws IOException {
+465 
+466             if (encrypt) {
+467                 try {
+468                     cipher = Cipher.getInstance(TRANSFORMATION);
+469                     cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv));
+470                 } catch (Exception e) {
+471                     delete();
+472                     throw new IOException("Cannot initialize decryption cipher!", e);
+473                 }
+474             } else {
+475                 cipher = null;
+476             }
+477 
+478             openStream();
+479         }
+480 
+481         protected void openStream() throws FileNotFoundException {
+482             if (encrypt) {
+483                 stream = new BufferedInputStream(new CipherInputStream(new FileInputStream(tempFile), cipher),
+484                         memoryThreshold);
+485             } else {
+486                 stream = new BufferedInputStream(new FileInputStream(tempFile), memoryThreshold);
+487             }
+488         }
+489 
+490         public boolean isInMemory() {
+491             return false;
+492         }
+493 
+494         public File getTemporaryFile() {
+495             return tempFile;
+496         }
+497 
+498         @Override
+499         public void rewind() throws IOException {
+500             if (isClosed) {
+501                 throw new IOException("Stream is already closed!");
+502             }
+503 
+504             stream.close();
+505 
+506             openStream();
+507         }
+508 
+509         @Override
+510         public int available() throws IOException {
+511             if (isClosed) {
+512                 return 0;
+513             }
+514 
+515             return stream.available();
+516         }
+517 
+518         @Override
+519         public boolean markSupported() {
+520             return stream.markSupported();
+521         }
+522 
+523         @Override
+524         public synchronized void mark(int readlimit) {
+525             if (!isClosed) {
+526                 stream.mark(readlimit);
+527             }
+528         }
+529 
+530         @Override
+531         public synchronized void reset() throws IOException {
+532             if (isClosed) {
+533                 throw new IOException("Stream is already closed!");
+534             }
+535 
+536             stream.reset();
+537         }
+538 
+539         @Override
+540         public long skip(long n) throws IOException {
+541             if (isClosed) {
+542                 return -1;
+543             }
+544 
+545             return stream.skip(n);
+546         }
+547 
+548         @Override
+549         public int read() throws IOException {
+550             if (isClosed) {
+551                 return -1;
+552             }
+553 
+554             int b = stream.read();
+555 
+556             if (b == -1) {
+557                 delete();
+558             }
+559 
+560             return b;
+561         }
+562 
+563         @Override
+564         public int read(byte[] b) throws IOException {
+565             return read(b, 0, b.length);
+566         }
+567 
+568         @Override
+569         public int read(byte[] b, int off, int len) throws IOException {
+570             if (isClosed) {
+571                 return -1;
+572             }
+573 
+574             int n = super.read(b, off, len);
+575 
+576             if (n == -1) {
+577                 delete();
+578             }
+579 
+580             return n;
+581         }
+582 
+583         @Override
+584         public void close() throws IOException {
+585             delete();
+586         }
+587 
+588         protected void delete() {
+589             if (!isClosed) {
+590                 try {
+591                     stream.close();
+592                     isClosed = true;
+593                 } catch (Exception e) {
+594                     // ignore
+595                 }
+596             }
+597 
+598             if (!isDeleted) {
+599                 isDeleted = tempFile.delete();
+600                 if (!isDeleted) {
+601                     LOG.warn("Temp file " + tempFile.getAbsolutePath() + " could not be deleted!");
+602                 }
+603             }
+604         }
+605     }
+606 }
+
+
+ + Added: chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStreamFactory.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStreamFactory.html?rev=1486787&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStreamFactory.html (added) +++ chemistry/site/trunk/content/java/0.9.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStreamFactory.html Tue May 28 07:21:41 2013 @@ -0,0 +1,108 @@ + + + + +ThresholdOutputStreamFactory xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.shared;
+20  
+21  import java.io.File;
+22  
+23  /**
+24   * A factory for {@link ThresholdOutputStream} objects.
+25   */
+26  public class ThresholdOutputStreamFactory {
+27  
+28      private File tempDir;
+29      private int memoryThreshold;
+30      private long maxContentSize;
+31      private boolean encrypt;
+32  
+33      private ThresholdOutputStreamFactory(File tempDir, int memoryThreshold, long maxContentSize, boolean encrypt) {
+34          this.tempDir = tempDir;
+35          this.memoryThreshold = memoryThreshold;
+36          this.maxContentSize = maxContentSize;
+37          this.encrypt = encrypt;
+38      }
+39  
+40      /**
+41       * Creates a new factory. The parameters are used to create new
+42       * {@link ThresholdOutputStream} objects.
+43       * 
+44       * @param tempDir
+45       *            temp directory or <code>null</code> for the default temp
+46       *            directory
+47       * @param memoryThreshold
+48       *            memory threshold in bytes
+49       * @param maxContentSize
+50       *            max size of the content in bytes (-1 to disable the check)
+51       * @param encrypt
+52       *            indicates if temporary files must be encrypted
+53       */
+54      public static ThresholdOutputStreamFactory newInstance(File tempDir, int memoryThreshold, long maxContentSize,
+55              boolean encrypt) {
+56          return new ThresholdOutputStreamFactory(tempDir, memoryThreshold, maxContentSize, encrypt);
+57      }
+58  
+59      /**
+60       * Creates a new {@link ThresholdOutputStream} object.
+61       */
+62      public ThresholdOutputStream newOutputStream() {
+63          return new ThresholdOutputStream(tempDir, memoryThreshold, maxContentSize, encrypt);
+64      }
+65  
+66      /**
+67       * Returns the temp directory or <code>null</code> for the default temp
+68       * directory.
+69       */
+70      public File getTempDir() {
+71          return tempDir;
+72      }
+73  
+74      /**
+75       * Returns the memory threshold in bytes.
+76       */
+77      public int getMemoryThreshold() {
+78          return memoryThreshold;
+79      }
+80  
+81      /**
+82       * Returns the max content size in bytes.
+83       */
+84      public long getMaxContentSize() {
+85          return maxContentSize;
+86      }
+87  
+88      /**
+89       * Indicates if temporary files are encrypted.
+90       */
+91      public boolean isEncrypted() {
+92          return encrypt;
+93      }
+94  }
+
+
+ +