/** * Grab the offset, then skip there */ private boolean skipToPropertyInfoSection(InputStream stream, byte[] header) throws IOException, TikaException { // The offset is stored in the header from 0x20 onwards long offsetToSection = EndianUtils.getLongLE(header, 0x20); // Sanity check the offset. Some files seem to use a different format, // and the offset isn't available at 0x20. Until we can work out how // to find the offset in those files, skip them if detected if (offsetToSection > 0xa00000l) { // Header should never be more than 10mb into the file, something is wrong offsetToSection = 0; } // Work out how far to skip, and sanity check long toSkip = offsetToSection - header.length; if(offsetToSection == 0){ return false; } while (toSkip > 0) { byte[] skip = new byte[Math.min((int) toSkip, 0x4000)]; IOUtils.readFully(stream, skip); toSkip -= skip.length; } return true; }
/** * Grab the offset, then skip there */ private boolean skipToPropertyInfoSection(InputStream stream, byte[] header) throws IOException, TikaException { // The offset is stored in the header from 0x20 onwards long offsetToSection = EndianUtils.getLongLE(header, 0x20); // Sanity check the offset. Some files seem to use a different format, // and the offset isn't available at 0x20. Until we can work out how // to find the offset in those files, skip them if detected if (offsetToSection > 0xa00000l) { // Header should never be more than 10mb into the file, something is wrong offsetToSection = 0; } // Work out how far to skip, and sanity check long toSkip = offsetToSection - header.length; if(offsetToSection == 0){ return false; } while (toSkip > 0) { byte[] skip = new byte[Math.min((int) toSkip, 0x4000)]; IOUtils.readFully(stream, skip); toSkip -= skip.length; } return true; }
/** * Grab the offset, then skip there */ private boolean skipToPropertyInfoSection(InputStream stream, byte[] header) throws IOException, TikaException { // The offset is stored in the header from 0x20 onwards long offsetToSection = EndianUtils.getLongLE(header, 0x20); // Sanity check the offset. Some files seem to use a different format, // and the offset isn't available at 0x20. Until we can work out how // to find the offset in those files, skip them if detected if (offsetToSection > 0xa00000l) { // Header should never be more than 10mb into the file, something is wrong offsetToSection = 0; } // Work out how far to skip, and sanity check long toSkip = offsetToSection - header.length; if(offsetToSection == 0){ return false; } while (toSkip > 0) { byte[] skip = new byte[Math.min((int) toSkip, 0x4000)]; IOUtils.readFully(stream, skip); toSkip -= skip.length; } return true; }