aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/android/java/com/google/devtools/build/android/DataValue.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2016-04-19 22:07:47 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-04-20 11:17:11 +0000
commit66cf13874a3c8f866aeace2d59231e30ca4a5032 (patch)
treee926e87be0c3f8ff8322cd2be20e5a534085010f /src/tools/android/java/com/google/devtools/build/android/DataValue.java
parent9b35d8a81b0d5cb92a22e7d9c7bf30a834711d7f (diff)
4 of 5: Serialization of UnwrittenMergedAndroidData.
Adding AndroidDataSerializer, the serialize_format proto, and KeyValueConsumers (utility class for keeping consumers straight). The serializtion is a bit more manual as previous experience has proven to me that simply writing all the resources into a proto map and pulling them out is not performant in the least. So, the serializer stores each message independent, the keys and then the values allowing for potential lazy loading and other optimizations in the future. Also adds tests for parsing and writing style resources. -- MOS_MIGRATED_REVID=120274904
Diffstat (limited to 'src/tools/android/java/com/google/devtools/build/android/DataValue.java')
-rw-r--r--src/tools/android/java/com/google/devtools/build/android/DataValue.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/DataValue.java b/src/tools/android/java/com/google/devtools/build/android/DataValue.java
index ded0ce5819..f30916f1f6 100644
--- a/src/tools/android/java/com/google/devtools/build/android/DataValue.java
+++ b/src/tools/android/java/com/google/devtools/build/android/DataValue.java
@@ -13,6 +13,8 @@
// limitations under the License.
package com.google.devtools.build.android;
+import java.io.IOException;
+import java.io.OutputStream;
import java.nio.file.Path;
/**
@@ -26,4 +28,9 @@ public interface DataValue {
* Provides the Path to the file from which the DataValue was derived.
*/
Path source();
+
+ /**
+ * Serializes to a supplied stream and returns the number of bytes written.
+ */
+ int serializeTo(DataKey key, OutputStream output) throws IOException;
}