KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > poifs > storage > RawDataBlockList


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19 package org.apache.poi.poifs.storage;
20
21 import java.io.*;
22
23 import java.util.*;
24
25 /**
26  * A list of RawDataBlocks instances, and methods to manage the list
27  *
28  * @author Marc Johnson (mjohnson at apache dot org
29  */

30
31 public class RawDataBlockList
32     extends BlockListImpl
33 {
34
35     /**
36      * Constructor RawDataBlockList
37      *
38      * @param stream the InputStream from which the data will be read
39      *
40      * @exception IOException on I/O errors, and if an incomplete
41      * block is read
42      */

43
44     public RawDataBlockList(final InputStream stream)
45         throws IOException
46     {
47         List blocks = new ArrayList();
48
49         while (true)
50         {
51             RawDataBlock block = new RawDataBlock(stream);
52
53             if (block.eof())
54             {
55                 break;
56             }
57             blocks.add(block);
58         }
59         setBlocks(( RawDataBlock [] ) blocks.toArray(new RawDataBlock[ 0 ]));
60     }
61 } // end public class RawDataBlockList
62

63
Popular Tags