Jump to content

Loading a GZIP compressed resource file


sxammy

Recommended Posts

G'day guys,

 

I'm using a trained Markov Chain to create random user names for an upcoming tutorial island script, however, when trying to load the saved markov_chain.dat file I'm getting the following exception:

 

I have verified that the file is found, of note the bytes available on the input stream are zero and the type of the InputStream is java.util.zip.ZipFile.ZipFileInflaterInputStream, is OSBot trying to do some magic for me or is it slapping my wrists for not following a convention?

 

Begin stack trace for Exception: [java.io.IOException: Stream closed]
java.util.zip.InflaterInputStream.ensureOpen(InflaterInputStream.java:67)
java.util.zip.InflaterInputStream.read(InflaterInputStream.java:142)
java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2781)
java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2797)
java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3274)
java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:934)
java.io.ObjectInputStream.<init>(ObjectInputStream.java:396)
org.sxam.osrs.bots.GarboIslando.utils.NameGenerator.MarkovChainGenerator.loadFromFile(MarkovChainGenerator.java:42)
org.sxam.osrs.bots.GarboIslando.utils.NameGenerator.NameGenerator.generateName(NameGenerator.java:21)
org.sxam.osrs.bots.GarboIslando.tasks.HandleGielinorGuideTask.sxamExecute(HandleGielinorGuideTask.java:77)
org.sxam.osrs.bot.structure.SXAMStateTask.executeCurrentTask(SXAMStateTask.java:116)
org.sxam.osrs.bot.structure.SXAMHarness.performStateWork(SXAMHarness.java:271)
org.sxam.osrs.bot.structure.SXAMHarness.TICK(SXAMHarness.java:255)
org.sxam.osrs.bot.structure.SXAMInterfaces$SXAMBotBaseInterface.sxamOnLoop(SXAMInterfaces.java:108)
org.sxam.osrs.bot.structure.osbot.looping.OSBotLoopRunner.onLoop(OSBotLoopRunner.java:69)
org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(ip:52)
java.lang.Thread.run(Thread.java:748)

 

The code:

Reading from getScriptResourceAsStream:

  public InputStream getResourceStream(String fileName) {
    return getPlatformMethodProvider().getScriptResourceAsStream(fileName);
  }

Loading from InputStream:

        NameGenerator.generator =
            MarkovChainGenerator.loadFromFile(
                SXAMExecutionEnvironment.Core.getResourceStream("markov_chain.dat"));

The Uber jar structure:

image.png.288de689152771835efc265125c0e61e.png

 

Any ideas guys? Am I barking up the wrong tree here?

 

Cheers,

Mitch.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...