List of usage examples for org.apache.commons.io.input CountingInputStream skip
public long skip(final long length) throws IOException
From source file:com.playonlinux.win32.pe.PEReader.java
private static RsrcSection readResourceSection(CountingInputStream executableInputStream, SectionHeader[] sectionHeaders) throws IOException { SectionHeader rsrcSectionHeader = null; for (SectionHeader sectionHeader : sectionHeaders) { if (".rsrc\u0000\u0000\u0000".equals(new String(sectionHeader.name))) { rsrcSectionHeader = sectionHeader; }/*from ww w. j a v a2 s .c o m*/ } if (rsrcSectionHeader == null) { return null; } long numberToSkip = rsrcSectionHeader.pointerToRawData.getUnsignedValue() - executableInputStream.getCount(); executableInputStream.skip(numberToSkip); byte[] rsrcSection = new byte[(int) rsrcSectionHeader.sizeOfRawData.getUnsignedValue()]; executableInputStream.read(rsrcSection); return new RsrcSection(rsrcSection); }
From source file:org.phoenicis.win32.pe.PEReader.java
private RsrcSection readResourceSection(CountingInputStream executableInputStream, SectionHeader[] sectionHeaders) throws IOException { SectionHeader rsrcSectionHeader = null; for (SectionHeader sectionHeader : sectionHeaders) { if (".rsrc\u0000\u0000\u0000".equals(new String(sectionHeader.name))) { rsrcSectionHeader = sectionHeader; }//from w w w. j av a 2 s. com } if (rsrcSectionHeader == null) { return null; } long numberToSkip = rsrcSectionHeader.pointerToRawData.getUnsignedValue() - executableInputStream.getCount(); executableInputStream.skip(numberToSkip); byte[] rsrcSection = new byte[(int) rsrcSectionHeader.sizeOfRawData.getUnsignedValue()]; executableInputStream.read(rsrcSection); return new RsrcSection(rsrcSection); }
From source file:org.sead.repositories.reference.RefRepository.java
private static long skipTo(CountingInputStream cis, long curPos, Long long1) throws IOException { log.trace("Skipping to : " + long1.longValue()); long offset = long1.longValue() - curPos; if (offset < 0) { log.error("Backwards jump attempted"); throw new IOException("Backward Skip: failed"); }// w w w.j a v a2 s . co m log.trace("At: " + curPos + " going forward by " + offset); long curskip = 0; while (curskip < offset) { long inc = cis.skip(offset - curskip); if (inc == -1) { log.error("End of Stream"); throw new IOException("End of Stream"); } curskip += inc; } return offset; }