-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change emoji description save format. Remove Jackson dependency.
- Loading branch information
Showing
643 changed files
with
163 additions
and
490 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
Large diffs are not rendered by default.
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
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,6 +1,5 @@ | ||
module net.fellbaum.jemoji { | ||
requires com.fasterxml.jackson.databind; | ||
|
||
opens net.fellbaum.jemoji to com.fasterxml.jackson.databind; | ||
//requires com.fasterxml.jackson.databind; | ||
//opens net.fellbaum.jemoji to com.fasterxml.jackson.databind; | ||
exports net.fellbaum.jemoji; | ||
} |
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
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,63 @@ | ||
package net.fellbaum.jemoji; | ||
|
||
import java.io.*; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.stream.Collectors; | ||
|
||
@SuppressWarnings("unused") | ||
public final class EmojiLoader { | ||
|
||
private EmojiLoader() { | ||
} | ||
|
||
static Object readFileAsObject(final String filePathName) { | ||
try { | ||
try (final InputStream is = EmojiManager.class.getResourceAsStream(filePathName)) { | ||
if (null == is) throw new IllegalStateException("InputStream is null"); | ||
final ObjectInputStream ois = new ObjectInputStream(is); | ||
final Object readObject = ois.readObject(); | ||
ois.close(); | ||
return readObject; | ||
} catch (final ClassNotFoundException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} catch (final IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
static String readFileAsString(final String filePathName) { | ||
try { | ||
try (final InputStream is = EmojiManager.class.getResourceAsStream(filePathName)) { | ||
if (null == is) throw new IllegalStateException("InputStream is null"); | ||
try (final InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8); | ||
final BufferedReader reader = new BufferedReader(isr)) { | ||
return reader.lines().collect(Collectors.joining(System.lineSeparator())); | ||
} | ||
} | ||
} catch (final IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
/** | ||
* Loads all emoji descriptions into memory to avoid potential description file reads during operation. | ||
* This will most likely be called once on startup of your application. | ||
*/ | ||
public static void loadAllEmojiDescriptions() { | ||
for (EmojiLanguage value : EmojiLanguage.values()) { | ||
EmojiManager.getEmojiDescriptionForLanguageAndEmoji(value, Emojis.THUMBS_UP.getEmoji()); | ||
} | ||
} | ||
|
||
/** | ||
* Loads all emoji descriptions into memory to avoid potential description file reads during operation. | ||
* This will most likely be called once on startup of your application. | ||
*/ | ||
public static void loadAllEmojiKeywords() { | ||
for (EmojiLanguage value : EmojiLanguage.values()) { | ||
EmojiManager.getEmojiKeywordsForLanguageAndEmoji(value, Emojis.THUMBS_UP.getEmoji()); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.