From 799e53d03946bb777cc612c1eb291d0700f23830 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Sun, 28 Jun 2015 17:54:20 +0000 Subject: [PATCH] Fix inconsistent whitespace git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1688031 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/poifs/dev/POIFSHeaderDumper.java | 268 +++++++++--------- 1 file changed, 134 insertions(+), 134 deletions(-) diff --git a/src/java/org/apache/poi/poifs/dev/POIFSHeaderDumper.java b/src/java/org/apache/poi/poifs/dev/POIFSHeaderDumper.java index 7856015e7f..98d912d49e 100644 --- a/src/java/org/apache/poi/poifs/dev/POIFSHeaderDumper.java +++ b/src/java/org/apache/poi/poifs/dev/POIFSHeaderDumper.java @@ -43,138 +43,138 @@ import org.apache.poi.util.IntList; * down the source of corruption in a file. */ public class POIFSHeaderDumper { - /** - * Display the entries of multiple POIFS files - * - * @param args the names of the files to be displayed - */ - public static void main(final String args[]) throws Exception { - if (args.length == 0) { - System.err.println("Must specify at least one file to view"); - System.exit(1); - } - - for (int j = 0; j < args.length; j++) { - viewFile(args[j]); - } - } - - public static void viewFile(final String filename) throws Exception { - System.out.println("Dumping headers from: " + filename); - InputStream inp = new FileInputStream(filename); - - // Header - HeaderBlock header_block = new HeaderBlock(inp); - displayHeader(header_block); - - // Raw blocks - POIFSBigBlockSize bigBlockSize = header_block.getBigBlockSize(); - RawDataBlockList data_blocks = new RawDataBlockList(inp, bigBlockSize); - displayRawBlocksSummary(data_blocks); - - // Main FAT Table - BlockAllocationTableReader batReader = - new BlockAllocationTableReader( - header_block.getBigBlockSize(), - header_block.getBATCount(), - header_block.getBATArray(), - header_block.getXBATCount(), - header_block.getXBATIndex(), - data_blocks); - displayBATReader("Big Blocks", batReader); - - // Properties Table - PropertyTable properties = - new PropertyTable(header_block, data_blocks); - - // Mini Fat - BlockAllocationTableReader sbatReader = - SmallBlockTableReader._getSmallDocumentBlockReader( - bigBlockSize, data_blocks, properties.getRoot(), - header_block.getSBATStart() - ); - displayBATReader("Small Blocks", sbatReader); - - // Summary of the properties - displayPropertiesSummary(properties); - } - - public static void displayHeader(HeaderBlock header_block) throws Exception { - System.out.println("Header Details:"); - System.out.println(" Block size: " + header_block.getBigBlockSize().getBigBlockSize()); - System.out.println(" BAT (FAT) header blocks: " + header_block.getBATArray().length); - System.out.println(" BAT (FAT) block count: " + header_block.getBATCount()); - if (header_block.getBATCount() > 0) - System.out.println(" BAT (FAT) block 1 at: " + header_block.getBATArray()[0]); - System.out.println(" XBAT (FAT) block count: " + header_block.getXBATCount()); - System.out.println(" XBAT (FAT) block 1 at: " + header_block.getXBATIndex()); - System.out.println(" SBAT (MiniFAT) block count: " + header_block.getSBATCount()); - System.out.println(" SBAT (MiniFAT) block 1 at: " + header_block.getSBATStart()); - System.out.println(" Property table at: " + header_block.getPropertyStart()); - System.out.println(""); - } - - public static void displayRawBlocksSummary(RawDataBlockList data_blocks) throws Exception { - System.out.println("Raw Blocks Details:"); - System.out.println(" Number of blocks: " + data_blocks.blockCount()); - - Method gbm = data_blocks.getClass().getSuperclass().getDeclaredMethod("get", int.class); - gbm.setAccessible(true); - - for(int i=0; i " + bnS); - } - - System.out.println(""); - } - - public static void displayPropertiesSummary(PropertyTable properties) { - System.out.println("Properties and their block start:"); - displayProperties(properties.getRoot(), ""); - System.out.println(""); - } - public static void displayProperties(DirectoryProperty prop, String indent) { - indent = indent + " "; - System.out.println(prop.getName()); - for (Property cp : prop) { - if (cp instanceof DirectoryProperty) { - displayProperties((DirectoryProperty)cp, indent); - } else { - // TODO - if (cp.shouldUseSmallBlocks()) { - - } - } - } - } + /** + * Display the entries of multiple POIFS files + * + * @param args the names of the files to be displayed + */ + public static void main(final String args[]) throws Exception { + if (args.length == 0) { + System.err.println("Must specify at least one file to view"); + System.exit(1); + } + + for (int j = 0; j < args.length; j++) { + viewFile(args[j]); + } + } + + public static void viewFile(final String filename) throws Exception { + System.out.println("Dumping headers from: " + filename); + InputStream inp = new FileInputStream(filename); + + // Header + HeaderBlock header_block = new HeaderBlock(inp); + displayHeader(header_block); + + // Raw blocks + POIFSBigBlockSize bigBlockSize = header_block.getBigBlockSize(); + RawDataBlockList data_blocks = new RawDataBlockList(inp, bigBlockSize); + displayRawBlocksSummary(data_blocks); + + // Main FAT Table + BlockAllocationTableReader batReader = + new BlockAllocationTableReader( + header_block.getBigBlockSize(), + header_block.getBATCount(), + header_block.getBATArray(), + header_block.getXBATCount(), + header_block.getXBATIndex(), + data_blocks); + displayBATReader("Big Blocks", batReader); + + // Properties Table + PropertyTable properties = + new PropertyTable(header_block, data_blocks); + + // Mini Fat + BlockAllocationTableReader sbatReader = + SmallBlockTableReader._getSmallDocumentBlockReader( + bigBlockSize, data_blocks, properties.getRoot(), + header_block.getSBATStart() + ); + displayBATReader("Small Blocks", sbatReader); + + // Summary of the properties + displayPropertiesSummary(properties); + } + + public static void displayHeader(HeaderBlock header_block) throws Exception { + System.out.println("Header Details:"); + System.out.println(" Block size: " + header_block.getBigBlockSize().getBigBlockSize()); + System.out.println(" BAT (FAT) header blocks: " + header_block.getBATArray().length); + System.out.println(" BAT (FAT) block count: " + header_block.getBATCount()); + if (header_block.getBATCount() > 0) + System.out.println(" BAT (FAT) block 1 at: " + header_block.getBATArray()[0]); + System.out.println(" XBAT (FAT) block count: " + header_block.getXBATCount()); + System.out.println(" XBAT (FAT) block 1 at: " + header_block.getXBATIndex()); + System.out.println(" SBAT (MiniFAT) block count: " + header_block.getSBATCount()); + System.out.println(" SBAT (MiniFAT) block 1 at: " + header_block.getSBATStart()); + System.out.println(" Property table at: " + header_block.getPropertyStart()); + System.out.println(""); + } + + public static void displayRawBlocksSummary(RawDataBlockList data_blocks) throws Exception { + System.out.println("Raw Blocks Details:"); + System.out.println(" Number of blocks: " + data_blocks.blockCount()); + + Method gbm = data_blocks.getClass().getSuperclass().getDeclaredMethod("get", int.class); + gbm.setAccessible(true); + + for(int i=0; i " + bnS); + } + + System.out.println(""); + } + + public static void displayPropertiesSummary(PropertyTable properties) { + System.out.println("Properties and their block start:"); + displayProperties(properties.getRoot(), ""); + System.out.println(""); + } + public static void displayProperties(DirectoryProperty prop, String indent) { + indent = indent + " "; + System.out.println(prop.getName()); + for (Property cp : prop) { + if (cp instanceof DirectoryProperty) { + displayProperties((DirectoryProperty)cp, indent); + } else { + // TODO + if (cp.shouldUseSmallBlocks()) { + + } + } + } + } } -- 2.39.5