java_streamify 0.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "minitest", ">= 0"
10
+ gem "yard", "~> 0.6.0"
11
+ gem "bundler", "~> 1.0.0"
12
+ gem "jeweler", "~> 1.6.4"
13
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Bill Dueber
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ = bytestreamify
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to java_streamify
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2012 Bill Dueber. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.version = '0.0.1'
18
+ gem.platform = 'java'
19
+ gem.name = "java_streamify"
20
+ gem.homepage = "http://github.com/billdueber/java_streamify"
21
+ gem.license = "MIT"
22
+ gem.summary = %Q{Easily turn a filename (with optional .gz) or File object into a Java inputstream or outputstream}
23
+ gem.description = %Q{that's really about it...}
24
+ gem.email = "bill@dueber.com"
25
+ gem.authors = ["Bill Dueber"]
26
+ # dependencies defined in Gemfile
27
+ end
28
+ Jeweler::RubygemsDotOrgTasks.new
29
+
30
+ require 'rake/testtask'
31
+ Rake::TestTask.new(:test) do |test|
32
+ test.libs << 'lib' << 'test'
33
+ test.pattern = 'test/**/test_*.rb'
34
+ test.verbose = true
35
+ end
36
+
37
+ task :default => :test
38
+
39
+ require 'yard'
40
+ YARD::Rake::YardocTask.new
@@ -0,0 +1,44 @@
1
+ unless defined? JRUBY_VERSION
2
+ raise "JavaStreamify only works under JRUBY"
3
+ end
4
+
5
+ module JavaStreamify
6
+ def self.inputstream(from, opts = {})
7
+ gzip = opts[:gz] || opts[:gzip]
8
+ stream = nil
9
+ if from.is_a? Java::JavaIO::InputStream
10
+ stream = from
11
+ elsif from.is_a? String
12
+ stream = java.io.FileInputStream.new(from.to_java_string)
13
+ gzip = true if from =~ /\.gz$/
14
+ elsif from.respond_to? :to_inputstream
15
+ stream = from.to_inputstream
16
+ end
17
+
18
+ if gzip
19
+ stream = Java::java.util.zip.GZIPInputStream.new(stream)
20
+ end
21
+
22
+ return stream
23
+ end
24
+
25
+ def self.outputstream(from, opts={})
26
+ stream = nil
27
+ gzip = opts[:gz] || opts[:gzip]
28
+ if from.is_a? Java::JavaIO::OutputStream
29
+ stream = from
30
+ elsif from.is_a? String
31
+ stream = java.io.FileOutputStream.new(from.to_java_string)
32
+ gzip = true if from =~ /\.gz$/
33
+ elsif from.respond_to? :to_outputstream
34
+ stream = from.to_outputstream
35
+ end
36
+
37
+ if gzip
38
+ stream = Java::java.util.zip.GZIPOutputStream.new(stream)
39
+ end
40
+
41
+ return stream
42
+ end
43
+ end
44
+
data/test/helper.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+
11
+ require 'minitest/spec'
12
+ require 'minitest/benchmark'
13
+
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
16
+ require 'java_streamify'
17
+
18
+ class MiniTest::Unit::TestCase
19
+ end
20
+
21
+ MiniTest::Unit.autorun
@@ -0,0 +1,6 @@
1
+ require 'helper'
2
+
3
+
4
+ describe JavaStreamify do
5
+
6
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: java_streamify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: java
7
+ authors:
8
+ - Bill Dueber
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: minitest
16
+ requirement: &2164419080 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *2164419080
25
+ - !ruby/object:Gem::Dependency
26
+ name: yard
27
+ requirement: &2164417020 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 0.6.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2164417020
36
+ - !ruby/object:Gem::Dependency
37
+ name: bundler
38
+ requirement: &2164414560 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.0.0
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2164414560
47
+ - !ruby/object:Gem::Dependency
48
+ name: jeweler
49
+ requirement: &2155895960 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.6.4
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2155895960
58
+ description: that's really about it...
59
+ email: bill@dueber.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files:
63
+ - LICENSE.txt
64
+ - README.md
65
+ files:
66
+ - .document
67
+ - Gemfile
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - lib/java_streamify.rb
72
+ - test/helper.rb
73
+ - test/test_java_streamify.rb
74
+ homepage: http://github.com/billdueber/java_streamify
75
+ licenses:
76
+ - MIT
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ segments:
88
+ - 0
89
+ hash: -4332366540055080969
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 1.8.15
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: Easily turn a filename (with optional .gz) or File object into a Java inputstream
102
+ or outputstream
103
+ test_files: []