aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/android/java/com/google/devtools/build/android/DataKey.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/DataKey.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/DataKey.java')
-rw-r--r--src/tools/android/java/com/google/devtools/build/android/DataKey.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/DataKey.java b/src/tools/android/java/com/google/devtools/build/android/DataKey.java
index ef447e0e25..e363bd74c4 100644
--- a/src/tools/android/java/com/google/devtools/build/android/DataKey.java
+++ b/src/tools/android/java/com/google/devtools/build/android/DataKey.java
@@ -13,8 +13,11 @@
// limitations under the License.
package com.google.devtools.build.android;
+import java.io.IOException;
+import java.io.OutputStream;
+
/**
- * A general marker interface for resource and asset keys.
+ * A general interface for resource and asset keys.
*
* Resource and Assets are merged on the basis of a key value:
*
@@ -23,4 +26,13 @@ package com.google.devtools.build.android;
*
* For Assets, it is the asset path from the assets directory.
*/
-public interface DataKey {}
+public interface DataKey {
+ /**
+ * Writes the Key and the value size to a stream.
+ *
+ * @param output The destination stream to serialize the key.
+ * @param valueSize The size, in bytes, of the serialized output for this key. The value size can
+ * be used for calculating offsets of the value in the stream.
+ */
+ void serializeTo(OutputStream output, int valueSize) throws IOException;
+}