Sha256: bdeea36c23f85635512a631e95c4297c4a2c023a234404bc309184c08d3ae2f1
Contents?: true
Size: 1.59 KB
Versions: 3
Compression:
Stored size: 1.59 KB
Contents
unless defined? JRUBY_VERSION raise "Only works under JRUBY" end jardir = File.join(File.dirname(__FILE__), '..', 'jars') # For each jar, check for a representative class in each # and include the jar if it's not defined begin include_class Java::org.marc4j.marc.impl.RecordImpl rescue NameError => e require "#{jardir}/javamarc.jar" end begin include_class Java::org.marc4j.MarcAlephSequentialReader rescue require "#{jardir}/marc4j-extra-readers-writers.jar" end begin include_class Java::org.codehaus.jackson.map.ObjectMapper rescue require "#{jardir}/jackson-all-1.6.0.jar" end # Define a method that will take a string (filename), IO object, or StringIO object, # and return an inputstream/outputstream module IOConvert def byteinstream(fromwhere) stream = nil if fromwhere.is_a? Java::JavaIO::InputStream stream = fromwhere elsif fromwhere.is_a? String stream = java.io.FileInputStream.new(fromwhere.to_java_string) elsif fromwhere.respond_to? :to_inputstream stream = fromwhere.to_inputstream end return stream end def byteoutstream towhere stream = nil if towhere.is_a? Java::JavaIO::OutputStream stream = towhere elsif towhere.is_a? String stream = java.io.FileOutputStream.new(towhere.to_java_string) elsif towhere.respond_to? :to_outputstream stream = towhere.to_outputstream end return stream end module_function :byteinstream, :byteoutstream end require 'marc4j4r/record.rb' require 'marc4j4r/controlfield.rb' require 'marc4j4r/reader.rb' require 'marc4j4r/datafield.rb'
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
marc4j4r-1.4.1 | lib/marc4j4r.rb |
marc4j4r-1.4.0 | lib/marc4j4r.rb |
marc4j4r-1.3.0 | lib/marc4j4r.rb |