Package org.exoplatform.services.jcr.impl.util.io

Examples of org.exoplatform.services.jcr.impl.util.io.SpoolFile


      OutputStream sfout = null;
      int read = 0;

      try
      {
         SpoolFile sf = SpoolFile.createTempFile("jcrvd", null, tempDirectory);
         sf.acquire(this);
         sfout = new FileOutputStream(sf);

         while ((read = tmpStream.read(tmpBuff)) >= 0)
            sfout.write(tmpBuff, 0, read);
View Full Code Here


      byte[] buffer = new byte[0];
      byte[] tmpBuff = new byte[2048];
      int read = 0;
      int len = 0;
      SpoolFile sf = null;
      OutputStream sfout = null;

      try
      {
         while ((read = tmpStream.read(tmpBuff)) >= 0)
         {
            if (sfout != null)
            {
               // spool to temp file
               sfout.write(tmpBuff, 0, read);
               len += read;
            }
            else if (len + read > maxBufferSize && fileCleaner != null)
            {
               // threshold for keeping data in memory exceeded,
               // if have a fileCleaner create temp file and spool buffer contents.
               sf = SpoolFile.createTempFile("jcrvd", null, tempDirectory);
               sf.acquire(this);

               sfout = new FileOutputStream(sf);
               sfout.write(buffer, 0, len);
               sfout.write(tmpBuff, 0, read);
               buffer = null;
View Full Code Here

         PersistedPropertyData propertyData = (PersistedPropertyData)itemData;
         ValueData vd = (propertyData.getValues().get(listFixupStream.get(i).getValueDataId()));

         // re-init the value
         propertyData.getValues().set(listFixupStream.get(i).getValueDataId(),
            new StreamPersistedValueData(vd.getOrderNumber(), new SpoolFile(listFile.get(i).getAbsolutePath())));
      }

      if (listRandomAccessFile != null)
         for (int i = 0; i < listRandomAccessFile.size(); i++)
            listRandomAccessFile.get(i).close();
View Full Code Here

         OutputStream sfout = null;
         int read = 0;

         try
         {
            SpoolFile sf = SpoolFile.createTempFile("jcrvd", null, tempDirectory);
            sf.acquire(this);
            sfout = PrivilegedFileHelper.fileOutputStream(sf);

            while ((read = tmpStream.read(tmpBuff)) >= 0)
               sfout.write(tmpBuff, 0, read);
View Full Code Here

         byte[] buffer = new byte[0];
         byte[] tmpBuff = new byte[2048];
         int read = 0;
         int len = 0;
         SpoolFile sf = null;
         OutputStream sfout = null;

         try
         {
            while ((read = tmpStream.read(tmpBuff)) >= 0)
            {
               if (sfout != null)
               {
                  // spool to temp file
                  sfout.write(tmpBuff, 0, read);
                  len += read;
               }
               else if (len + read > maxBufferSize && fileCleaner != null)
               {
                  // threshold for keeping data in memory exceeded,
                  // if have a fileCleaner create temp file and spool buffer contents.
                  sf = SpoolFile.createTempFile("jcrvd", null, tempDirectory);
                  sf.acquire(this);

                  sfout = PrivilegedFileHelper.fileOutputStream(sf);

                  sfout.write(buffer, 0, len);
                  sfout.write(tmpBuff, 0, read);
View Full Code Here

                              File pfile = propertyValue.getFile();
                              if (pfile != null)
                              {
                                 vdata =
                                    new TransientValueData(currentProperty.getValues().size(), null, null,
                                       new SpoolFile(PrivilegedFileHelper.getAbsolutePath(pfile)), fileCleaner,
                                       maxBufferSize, null, true);
                              }
                              else
                              {
                                 vdata = new TransientValueData(currentProperty.getValues().size(), new byte[]{});
View Full Code Here

                              File pfile = propertyValue.getFile();
                              if (pfile != null)
                              {
                                 vdata =
                                    new TransientValueData(currentProperty.getValues().size(), null, null,
                                       new SpoolFile(PrivilegedFileHelper.getAbsolutePath(pfile)), fileCleaner,
                                       maxBufferSize, null, true);
                              }
                              else
                              {
                                 vdata = new TransientValueData(currentProperty.getValues().size(), new byte[]{});
View Full Code Here

                              File pfile = propertyValue.getFile();
                              if (pfile != null)
                              {
                                 vdata =
                                    new TransientValueData(currentProperty.getValues().size(), null, null,
                                       new SpoolFile(PrivilegedFileHelper.getAbsolutePath(pfile)), fileCleaner,
                                       maxBufferSize, null, true);
                              }
                              else
                              {
                                 vdata = new TransientValueData(currentProperty.getValues().size(), new byte[]{});
View Full Code Here

   private SpoolFile getAsFile(ObjectInputStream ois, long fileSize) throws IOException
   {
      int bufferSize = 1024 * 8;
      byte[] buf = new byte[bufferSize];

      SpoolFile tempFile = SpoolFile.createTempFile("vdincb" + System.currentTimeMillis(), ".stmp", tempDir);
      FileOutputStream fos = PrivilegedFileHelper.fileOutputStream(tempFile);
      long readBytes = fileSize;

      while (readBytes > 0)
      {
View Full Code Here

   private SpoolFile getAsFile(ObjectInputStream ois, long fileSize) throws IOException
   {
      int bufferSize = 1024 * 8;
      byte[] buf = new byte[bufferSize];

      SpoolFile tempFile = SpoolFile.createTempFile("vdincb" + System.currentTimeMillis(), ".stmp", tempDir);
      FileOutputStream fos = PrivilegedFileHelper.fileOutputStream(tempFile);
      long readBytes = fileSize;

      while (readBytes > 0)
      {
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.util.io.SpoolFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.