See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.poifs.common;
public interface POIFSConstants
{
/** Most files use 512 bytes as their big block size */
- public static final int SMALLER_BIG_BLOCK_SIZE = 0x0200;
- public static final POIFSBigBlockSize SMALLER_BIG_BLOCK_SIZE_DETAILS =
+ int SMALLER_BIG_BLOCK_SIZE = 0x0200;
+ POIFSBigBlockSize SMALLER_BIG_BLOCK_SIZE_DETAILS =
new POIFSBigBlockSize(SMALLER_BIG_BLOCK_SIZE, (short)9);
/** Some use 4096 bytes */
- public static final int LARGER_BIG_BLOCK_SIZE = 0x1000;
- public static final POIFSBigBlockSize LARGER_BIG_BLOCK_SIZE_DETAILS =
+ int LARGER_BIG_BLOCK_SIZE = 0x1000;
+ POIFSBigBlockSize LARGER_BIG_BLOCK_SIZE_DETAILS =
new POIFSBigBlockSize(LARGER_BIG_BLOCK_SIZE, (short)12);
-
+
/** How big a block in the small block stream is. Fixed size */
- public static final int SMALL_BLOCK_SIZE = 0x0040;
-
+ int SMALL_BLOCK_SIZE = 0x0040;
+
/** How big a single property is */
- public static final int PROPERTY_SIZE = 0x0080;
-
- /**
- * The minimum size of a document before it's stored using
- * Big Blocks (normal streams). Smaller documents go in the
+ int PROPERTY_SIZE = 0x0080;
+
+ /**
+ * The minimum size of a document before it's stored using
+ * Big Blocks (normal streams). Smaller documents go in the
* Mini Stream (SBAT / Small Blocks)
*/
- public static final int BIG_BLOCK_MINIMUM_DOCUMENT_SIZE = 0x1000;
-
+ int BIG_BLOCK_MINIMUM_DOCUMENT_SIZE = 0x1000;
+
/** The highest sector number you're allowed, 0xFFFFFFFA */
- public static final int LARGEST_REGULAR_SECTOR_NUMBER = -5;
-
+ int LARGEST_REGULAR_SECTOR_NUMBER = -5;
+
/** Indicates the sector holds a DIFAT block (0xFFFFFFFC) */
- public static final int DIFAT_SECTOR_BLOCK = -4;
+ int DIFAT_SECTOR_BLOCK = -4;
/** Indicates the sector holds a FAT block (0xFFFFFFFD) */
- public static final int FAT_SECTOR_BLOCK = -3;
+ int FAT_SECTOR_BLOCK = -3;
/** Indicates the sector is the end of a chain (0xFFFFFFFE) */
- public static final int END_OF_CHAIN = -2;
+ int END_OF_CHAIN = -2;
/** Indicates the sector is not used (0xFFFFFFFF) */
- public static final int UNUSED_BLOCK = -1;
-
+ int UNUSED_BLOCK = -1;
+
/** The first 4 bytes of an OOXML file, used in detection */
- public static final byte[] OOXML_FILE_HEADER =
+ byte[] OOXML_FILE_HEADER =
new byte[] { 0x50, 0x4b, 0x03, 0x04 };
/** The first 5 bytes of a raw XML file, used in detection */
- public static final byte[] RAW_XML_FILE_HEADER =
+ byte[] RAW_XML_FILE_HEADER =
new byte[] { 0x3c, 0x3f, 0x78, 0x6d, 0x6c };
} // end public interface POIFSConstants;
groups.add(matchResult.group(i));
}
int year = format.hasYear
- ? Integer.valueOf(groups.get(format.yearIndex))
+ ? Integer.parseInt(groups.get(format.yearIndex))
: LocalDate.now(LocaleUtil.getUserTimeZone().toZoneId()).getYear();
int month = parseMonth(groups.get(format.monthIndex));
- int day = Integer.valueOf(groups.get(format.dayIndex));
+ int day = Integer.parseInt(groups.get(format.dayIndex));
return new NumberEval(DateUtil.getExcelDate(LocalDate.of(year, month, day)));
}
private int parseMonth(String monthPart) {
try {
- return Integer.valueOf(monthPart);
+ return Integer.parseInt(monthPart);
} catch (NumberFormatException ignored) {
}
Workbook apply(T t, U u) throws IOException;
}
- private static Object hssfLock = new Object();
- private static Object xssfLock = new Object();
+ private static final Object hssfLock = new Object();
+ private static final Object xssfLock = new Object();
+
protected static CreateWorkbook0 createHssfFromScratch;
protected static CreateWorkbook1<DirectoryNode> createHssfByNode;
synchronized (xssfLock) {
if (createXssfFromScratch == null) {
String factoryClass = "org.apache.poi.xssf.usermodel.XSSFWorkbookFactory";
- Class cls = initFactory(factoryClass, "poi-ooxml-*.jar");
+ Class<?> cls = initFactory(factoryClass, "poi-ooxml-*.jar");
try {
cls.getMethod("init").invoke(null);
} catch (Exception e) {
synchronized (hssfLock) {
if (createHssfFromScratch == null) {
String factoryClass = "org.apache.poi.hssf.usermodel.HSSFWorkbookFactory";
- Class cls = initFactory(factoryClass, "poi-*.jar");
+ Class<?> cls = initFactory(factoryClass, "poi-*.jar");
try {
cls.getMethod("init").invoke(null);
} catch (Exception e) {
}
}
- private static Class initFactory(String factoryClass, String jar) throws IOException {
+ private static Class<?> initFactory(String factoryClass, String jar) throws IOException {
try {
return Class.forName(factoryClass, true, WorkbookFactory.class.getClassLoader());
} catch (ClassNotFoundException e) {