diff options
author | Nick Burch <nick@apache.org> | 2010-12-19 08:06:48 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2010-12-19 08:06:48 +0000 |
commit | 302df8aa4c8f5435efc2bbde929de2431308904d (patch) | |
tree | 678b79b3170639a5c60d4bb9ec508a0fa6628ba0 /src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java | |
parent | ced5abd45761ea3659bd0d6d60920e22f74ac06b (diff) | |
download | poi-302df8aa4c8f5435efc2bbde929de2431308904d.tar.gz poi-302df8aa4c8f5435efc2bbde929de2431308904d.zip |
Initial work on a NIO POIFSFileSystem. Currently is able to open the file and read the header, but no more
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1050773 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java')
-rw-r--r-- | src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java b/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java new file mode 100644 index 0000000000..387d15b800 --- /dev/null +++ b/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java @@ -0,0 +1,59 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.poifs.filesystem; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Iterator; + +import junit.framework.TestCase; + +import org.apache.poi.POIDataSamples; +import org.apache.poi.hssf.HSSFTestDataSamples; +import org.apache.poi.poifs.common.POIFSBigBlockSize; +import org.apache.poi.poifs.storage.HeaderBlock; +import org.apache.poi.poifs.storage.RawDataBlockList; + +/** + * Tests for the new NIO POIFSFileSystem implementation + */ +public final class TestNPOIFSFileSystem extends TestCase { + private static final POIDataSamples _inst = POIDataSamples.getPOIFSInstance(); + + public void testBasicOpen() throws Exception { + NPOIFSFileSystem fsA, fsB; + + // With a simple 512 block file + fsA = new NPOIFSFileSystem(_inst.getFile("BlockSize512.zvi")); + fsB = new NPOIFSFileSystem(_inst.openResourceAsStream("BlockSize512.zvi")); + for(NPOIFSFileSystem fs : new NPOIFSFileSystem[] {fsA,fsB}) { + assertEquals(512, fs.getBigBlockSize()); + } + + // Now with a simple 4096 block file + fsA = new NPOIFSFileSystem(_inst.getFile("BlockSize4096.zvi")); + fsB = new NPOIFSFileSystem(_inst.openResourceAsStream("BlockSize4096.zvi")); + for(NPOIFSFileSystem fs : new NPOIFSFileSystem[] {fsA,fsB}) { + assertEquals(4096, fs.getBigBlockSize()); + } + } + +} |