From e627fa54a2deb29f378d8d2e69e2af09aa57ca40 Mon Sep 17 00:00:00 2001
From: Nick Burch
Creates a POIFSFileSystem from an open FileChannel. This uses - * less memory than creating from an InputStream.
+ * less memory than creating from an InputStream. The stream will + * be used in read-write mode. * *Note that with this constructor, you will need to call {@link #close()} * when you're done to have the underlying Channel closed, as the channel is @@ -181,6 +183,25 @@ public class NPOIFSFileSystem extends BlockStore this(channel, null, false, false); } + /** + *
Creates a POIFSFileSystem from an open FileChannel. This uses + * less memory than creating from an InputStream.
+ * + *Note that with this constructor, you will need to call {@link #close()} + * when you're done to have the underlying Channel closed, as the channel is + * kept open during normal operation to read the data out.
+ * + * @param channel the FileChannel from which to read or read/write the data + * @param readOnly whether the POIFileSystem will only be used in read-only mode + * + * @exception IOException on errors reading, or on invalid data + */ + public NPOIFSFileSystem(FileChannel channel, boolean readOnly) + throws IOException + { + this(channel, null, readOnly, false); + } + private NPOIFSFileSystem(FileChannel channel, File srcFile, boolean readOnly, boolean closeChannelOnError) throws IOException { -- 2.39.5