Lines 55-63
Link Here
|
55 |
* @param stream the InputStream from which the data will be read |
55 |
* @param stream the InputStream from which the data will be read |
56 |
* @param blockSize the size of the POIFS blocks, normally 512 bytes {@link POIFSConstants#BIG_BLOCK_SIZE} |
56 |
* @param blockSize the size of the POIFS blocks, normally 512 bytes {@link POIFSConstants#BIG_BLOCK_SIZE} |
57 |
* |
57 |
* |
58 |
* @exception IOException on I/O errors, and if an insufficient |
58 |
* @exception IOException on I/O errors |
59 |
* amount of data is read (the InputStream must |
|
|
60 |
* be an exact multiple of the block size) |
61 |
*/ |
59 |
*/ |
62 |
public RawDataBlock(final InputStream stream, int blockSize) |
60 |
public RawDataBlock(final InputStream stream, int blockSize) |
63 |
throws IOException { |
61 |
throws IOException { |
Lines 72-83
Link Here
|
72 |
// requested number of bytes, unless it hits |
70 |
// requested number of bytes, unless it hits |
73 |
// an EOF |
71 |
// an EOF |
74 |
_eof = true; |
72 |
_eof = true; |
75 |
String type = " byte" + ((count == 1) ? ("") |
|
|
76 |
: ("s")); |
77 |
|
78 |
throw new IOException("Unable to read entire block; " + count |
79 |
+ type + " read before EOF; expected " |
80 |
+ blockSize + " bytes"); |
81 |
} |
73 |
} |
82 |
else { |
74 |
else { |
83 |
_eof = false; |
75 |
_eof = false; |
Lines 110-116
Link Here
|
110 |
public byte [] getData() |
102 |
public byte [] getData() |
111 |
throws IOException |
103 |
throws IOException |
112 |
{ |
104 |
{ |
113 |
if (eof()) |
105 |
if (eof() && _data.length<=0) |
114 |
{ |
106 |
{ |
115 |
throw new IOException("Cannot return empty data"); |
107 |
throw new IOException("Cannot return empty data"); |
116 |
} |
108 |
} |