I'm working with a Java library in JRuby. I'm reading an object from a file, and I need to pass it as a different object type to a second constructor:
@hmm_model = ObjectInputStream.new(FileInputStream.new(LINGPIPE_MODEL_PATH))
@tagger = HmmDecoder.new(@hmm_model)
@hmm_model is of type ObjectInputStream, and needs to be cast to (HiddenMarkovModel). Obviously, that'd be easy in Java, it would just be:
@tagger = HmmDecoder.new((HiddenMarkovModel)@hmm_model)
But, of course, that doesn't work in JRuby. Is there actually any way to explicitly cast the @hmm_model to be of the correct type?