29
29
import com .zimbra .cs .store .file .FileBlobStore ;
30
30
import com .zimbra .cs .store .helper .ClassHelper ;
31
31
import com .zimbra .cs .util .Zimbra ;
32
+ import com .zimbra .cs .volume .Volume ;
32
33
import com .zimbra .cs .volume .VolumeManager ;
33
34
34
35
import java .io .IOException ;
@@ -46,6 +47,7 @@ public abstract class StoreManager {
46
47
*/
47
48
private static short currentVolumeId ;
48
49
private static Integer diskStreamingThreshold ;
50
+ private static final int actualSizeforUnstagedBlob = -1 ;
49
51
50
52
51
53
public static StoreManager getInstance () {
@@ -292,6 +294,20 @@ public abstract Blob storeIncoming(InputStream data, boolean storeAsIs)
292
294
public abstract StagedBlob stage (InputStream data , long actualSize , Mailbox mbox )
293
295
throws IOException , ServiceException ;
294
296
297
+ /**
298
+ * Stage an incoming <code>InputStream</code> to an
299
+ * appropriate place for subsequent storage in a <code>Mailbox</code> via
300
+ * {@link #link(StagedBlob, Mailbox, int, int)} or {@link #renameTo}.
301
+ *
302
+ * @param data the data stream
303
+ * @param actualSize the content size, or {@code -1} if the content size is not available
304
+ * @param callback callback, or {@code null}
305
+ * @param mbox the mailbox
306
+ * @param volume the volume
307
+ */
308
+ public abstract StagedBlob stage (InputStream data , long actualSize , Mailbox mbox , Volume volume )
309
+ throws IOException , ServiceException ;
310
+
295
311
/**
296
312
* Stage an incoming <code>InputStream</code> to an
297
313
* appropriate place for subsequent storage in a <code>Mailbox</code> via
@@ -303,7 +319,22 @@ public abstract StagedBlob stage(InputStream data, long actualSize, Mailbox mbox
303
319
*/
304
320
public StagedBlob stage (InputStream data , Mailbox mbox )
305
321
throws IOException , ServiceException {
306
- return stage (data , -1 , mbox );
322
+ return stage (data , actualSizeforUnstagedBlob , mbox );
323
+ }
324
+
325
+ /**
326
+ * Stage an incoming <code>InputStream</code> to an
327
+ * appropriate place for subsequent storage in a <code>Mailbox</code> via
328
+ * {@link #link(StagedBlob, Mailbox, int, int)} or {@link #renameTo}.
329
+ *
330
+ * @param data the data stream
331
+ * @param callback callback, or {@code null}
332
+ * @param mbox the mailbox
333
+ * @param volume the volume
334
+ */
335
+ public StagedBlob stage (InputStream data , Mailbox mbox , Volume volume )
336
+ throws IOException , ServiceException {
337
+ return stage (data , actualSizeforUnstagedBlob , mbox , volume );
307
338
}
308
339
309
340
/**
0 commit comments