Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
a0efebf3
Commit
a0efebf3
authored
13 years ago
by
Jean Chalard
Committed by
Android (Google) Code Review
13 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Allow use of assets for data in the dictionary content provider."
parents
73544ade
4e3bd58b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
+6
-3
6 additions, 3 deletions
...android/inputmethod/latin/BinaryDictionaryFileDumper.java
with
6 additions
and
3 deletions
java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
+
6
−
3
View file @
a0efebf3
...
...
@@ -18,6 +18,7 @@ package com.android.inputmethod.latin;
import
android.content.ContentResolver
;
import
android.content.Context
;
import
android.content.res.AssetFileDescriptor
;
import
android.net.Uri
;
import
android.text.TextUtils
;
...
...
@@ -96,9 +97,9 @@ public class BinaryDictionaryFileDumper {
// file.
final
ContentResolver
resolver
=
context
.
getContentResolver
();
final
Uri
dictionaryPackUri
=
getProviderUri
(
locale
);
final
InputStream
stream
=
resolver
.
openInputStream
(
dictionaryPackUri
);
if
(
null
==
stream
)
return
null
;
return
copyFileTo
(
s
tream
,
getCacheFileNameForLocale
(
locale
,
context
));
final
AssetFileDescriptor
afd
=
resolver
.
openAssetFileDescriptor
(
dictionaryPackUri
,
"r"
);
if
(
null
==
afd
)
return
null
;
return
copyFileTo
(
afd
.
createInputS
tream
()
,
getCacheFileNameForLocale
(
locale
,
context
));
}
/**
...
...
@@ -128,6 +129,8 @@ public class BinaryDictionaryFileDumper {
/**
* Copies the data in an input stream to a target file, creating the file if necessary and
* overwriting it if it already exists.
* @param input the stream to be copied.
* @param outputFileName the name of a file to copy the data to. It is created if necessary.
*/
private
static
String
copyFileTo
(
final
InputStream
input
,
final
String
outputFileName
)
throws
FileNotFoundException
,
IOException
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment