diff options
author | Elliott Hughes <enh@google.com> | 2010-02-22 12:09:51 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2010-02-22 12:09:51 -0800 |
commit | e2a6f77f112c01109db196d8b19767896ee977ea (patch) | |
tree | c18066db46425e09a89b679c3b08153d0480d7e7 /support/src/test | |
parent | cb78ba4051c82075119fd3646922a41e6355151b (diff) | |
parent | ea6435b142df4aaaf8854b3200b9f442b331f143 (diff) | |
download | libcore-e2a6f77f112c01109db196d8b19767896ee977ea.zip libcore-e2a6f77f112c01109db196d8b19767896ee977ea.tar.gz libcore-e2a6f77f112c01109db196d8b19767896ee977ea.tar.bz2 |
Merge remote branch 'goog/master' into mm
Conflicts:
libcore/JavaLibrary.mk
Diffstat (limited to 'support/src/test')
-rw-r--r-- | support/src/test/java/tests/support/resource/Support_Resources.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/support/src/test/java/tests/support/resource/Support_Resources.java b/support/src/test/java/tests/support/resource/Support_Resources.java index 53a8925..67b6001 100644 --- a/support/src/test/java/tests/support/resource/Support_Resources.java +++ b/support/src/test/java/tests/support/resource/Support_Resources.java @@ -205,4 +205,20 @@ public class Support_Resources { throw new RuntimeException("Failed to load resource: " + name); } } + + public static File resourceToTempFile(String path) throws IOException { + File f = File.createTempFile("out", ".xml"); + f.deleteOnExit(); + FileOutputStream out = new FileOutputStream(f); + + InputStream xml = Support_Resources.class.getResourceAsStream(path); + int b; + while ((b = xml.read()) != -1) { + out.write(b); + } + out.flush(); + out.close(); + xml.close(); + return f; + } } |