Search in sources :

Example 31 with CountingInputStream

use of org.apache.commons.io.input.CountingInputStream in project phoenicis by PhoenicisOrg.

the class PEReader method parseExecutable.

public PEFile parseExecutable(InputStream inputStream) throws IOException {
    try (CountingInputStream executableInputStream = new CountingInputStream(inputStream)) {
        final ImageDOSHeader imageDOSHeader = readDosHeader(executableInputStream);
        final byte[] realModeStubProgram = readRealModeStubProgram(executableInputStream, imageDOSHeader);
        final ImageNTHeaders imageNTHeaders = readImageNTHeaders(executableInputStream);
        final SectionHeader[] sectionHeaders = readSectionHeaders(executableInputStream, imageNTHeaders);
        final RsrcSection resourceSection = readResourceSection(executableInputStream, sectionHeaders);
        return new PEFile(imageDOSHeader, realModeStubProgram, imageNTHeaders, sectionHeaders, resourceSection);
    }
}
Also used : RsrcSection(org.phoenicis.win32.pe.rsrc.RsrcSection) CountingInputStream(org.apache.commons.io.input.CountingInputStream)

Aggregations

CountingInputStream (org.apache.commons.io.input.CountingInputStream)31 Test (org.junit.Test)17 ByteArrayInputStream (java.io.ByteArrayInputStream)15 InputStream (java.io.InputStream)8 Chapter (de.danoeh.antennapod.model.feed.Chapter)7 IOException (java.io.IOException)7 FrameHeader (de.danoeh.antennapod.parser.media.id3.model.FrameHeader)4 BufferedInputStream (java.io.BufferedInputStream)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 GZIPInputStream (java.util.zip.GZIPInputStream)3 ZipInputStream (java.util.zip.ZipInputStream)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 RsrcSection (org.phoenicis.win32.pe.rsrc.RsrcSection)2 Logger (org.slf4j.Logger)2 NodeStatisticsMessage (com.sedmelluq.discord.lavaplayer.remote.message.NodeStatisticsMessage)1 RemoteMessage (com.sedmelluq.discord.lavaplayer.remote.message.RemoteMessage)1 TrackExceptionMessage (com.sedmelluq.discord.lavaplayer.remote.message.TrackExceptionMessage)1 TrackFrameDataMessage (com.sedmelluq.discord.lavaplayer.remote.message.TrackFrameDataMessage)1 TrackStartResponseMessage (com.sedmelluq.discord.lavaplayer.remote.message.TrackStartResponseMessage)1