-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from tamada/initial_release
最初のリリースをマージする.
- Loading branch information
Showing
64 changed files
with
1,560 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
language: java | ||
jdk: | ||
- oraclejdk8 | ||
|
||
env: | ||
secure: "FEVnbx67LZNZEswG4BAs0pgHnLGifjFXYF3I2Ljt7HuW3JUzfzXJB6kl/pJy83Uig2QRrIeEKghsEJsa8D1TnwrWaWUH+PRTXqGnPe3FxWl6lCwh/oWVBLgj6pPAh/0LKpsw5hcw6ZZ590+3yHffvr3s8i1qKSbZGflf7UH3E07c1QHEM2qi8+rjSvuIjOt+ynSS44t6Jiewmc2iAY+J/eBbbLSkgevXo4tpUHhgsEtWqbCHmeKxoXMZX0ty8n+DmzVaZhrr6RCEkyfNIINvuwB2MldHuwCIsunZBTXPZViE8esSxiPPXwef7OwAsYaMzNCSdhmv7j3Gb1uMqCxqG4WpRfSzr+aeK9CcuPmdYXGODiN6MRcHwb/4/wf0F9Axg7vdAIB+fKUTkGDTV3/fwOLjuLcrss9v4uLot9p57t5HdmQ0zLDvIQCtCdlJgjpNssxb13peE8TD4JoD0opTCu9FQoC+gdwyTOkLK4aKTFFr8SNeiL6lx+0DsH8xaICm4BO1CMV/moRBOt6KChIgode7gUlDP2wm34/9EcapVoCaNSDPXHbYw0hPyHlBw59SAihomuEKGPPxX/bUABWzp5vJfSdKQlETNd1oiaEAGR2GnUl6RMYGVk7/uq2U+nAi7PYD0oXOHoMdr/yK7GGq/hR43bTeic514B+J1S5ronY=" | ||
|
||
after_success: | ||
- mvn -DrepoToken=$COVERALLS_TOKEN clean test jacoco:report coveralls:report | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
[![Build Status](https://travis-ci.org/tamada/kunai2.svg?branch=master)](https://travis-ci.org/tamada/kunai2) | ||
[![Coverage Status](https://coveralls.io/repos/github/tamada/kunai2/badge.svg?branch=master)](https://coveralls.io/github/tamada/kunai2?branch=master) | ||
[![codebeat badge](https://codebeat.co/badges/2f934b12-6c8e-439a-81e9-694b89789374)](https://codebeat.co/projects/github-com-tamada-kunai2) | ||
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat)](https://github.com/tamada/9rules/blob/master/LICENSE) | ||
|
||
# kunai2 | ||
Kunai for Java 8 | ||
|
||
This tool is to read/store class files from/to directories, jar file, and war files. | ||
[kunai](https://github.com/tamada/kunai) is same tool, however, kunai is for Java 7 or before. | ||
Kunai2 implemented for Java 8 and used streaming API. | ||
|
||
## Simply use. | ||
|
||
### Reading | ||
|
||
```java | ||
Path path = Paths.get("target/source"); | ||
DataSource source = new DefaultDataSourceFactory().build(path); | ||
source.stream(); | ||
// some operation for stream. | ||
``` | ||
|
||
### Storing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.github.kunai; | ||
|
||
import java.nio.file.Paths; | ||
|
||
import com.github.kunai.sink.DataSink; | ||
import com.github.kunai.sink.factories.DataSinkFactoryBuilder; | ||
import com.github.kunai.source.DataSource; | ||
import com.github.kunai.source.factories.DefaultDataSourceFactory; | ||
|
||
public class Demo { | ||
public Demo(String[] args) throws Exception{ | ||
copy(args[0], args[1]); | ||
} | ||
|
||
private void copy(String from, String to) throws Exception{ | ||
try(DataSource source = new DefaultDataSourceFactory().build(Paths.get(from)); | ||
DataSink sink = new DataSinkFactoryBuilder().create(Paths.get(to))){ | ||
copy(source, sink); | ||
} | ||
} | ||
|
||
private void copy(DataSource source, DataSink sink) throws Exception{ | ||
sink.consume(source); | ||
} | ||
|
||
public static final void main(String[] args) throws Exception{ | ||
new Demo(args); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,9 @@ | ||
package com.github.kunai.entries; | ||
|
||
import java.nio.file.Path; | ||
|
||
|
||
public class ClassName extends Name{ | ||
private static final long serialVersionUID = -1305904437135129418L; | ||
|
||
public ClassName(String name){ | ||
super(name); | ||
} | ||
|
||
public static ClassName parse(Path path){ | ||
String name = path.toString(); | ||
if(name.startsWith("/")){ | ||
int lastIndex = name.length(); | ||
lastIndex = lastIndex - ".class".length(); | ||
name = name.substring(1, lastIndex); | ||
} | ||
return new ClassName(name.replace('/', '.')); | ||
super(name.replace('/', '.')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.