Skip to content

Commit

Permalink
Merge pull request #6 from MrTimeey/add_load_bytes
Browse files Browse the repository at this point in the history
Template for loading byte[] from resource file
  • Loading branch information
Tim Siegler authored Oct 15, 2020
2 parents 7266a72 + 3c6f7ca commit 5a80f7f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ Options:
- [ ] Use static import if possible
- [x] Shorten FQ names

### Load byte[] from resources directory
Loads byte[] from resources directory.

![Load bytes from resource file](load_bytes/example.gif)

Abbreviation: __bytesfile__

Template text:
```
try (java.io.InputStream is = getClass().getClassLoader().getResourceAsStream("$Function$")) {
byte[] bytes = is.readAllBytes();
}
```
Options:
- [x] Reformat according to style
- [ ] Use static import if possible
- [x] Shorten FQ names


### Create UUID for Spring Data Entity
Creates ID field for entity class which will be auto generated as UUID.
Expand Down
6 changes: 6 additions & 0 deletions custom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@
<option name="JAVA_CODE" value="true" />
</context>
</template>
<template name="bytesfile" value="try (java.io.InputStream is = getClass().getClassLoader().getResourceAsStream(&quot;$Function$&quot;)) {&#10; byte[] bytes = is.readAllBytes();&#10;}" description="Get byte[] from resources file" toReformat="false" toShortenFQNames="true">
<variable name="Function" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_CODE" value="true" />
</context>
</template>
</templateSet>
Binary file added load_bytes/example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified settings.zip
Binary file not shown.

0 comments on commit 5a80f7f

Please sign in to comment.