(DataInput in)
| 109 | } |
| 110 | |
| 111 | private final void readFieldsCompressed(DataInput in) throws IOException { |
| 112 | byte oldVersion = in.readByte(); |
| 113 | switch (oldVersion) { |
| 114 | case 0: |
| 115 | case 1: |
| 116 | url = Text.readString(in); // read url |
| 117 | base = Text.readString(in); // read base |
| 118 | |
| 119 | content = new byte[in.readInt()]; // read content |
| 120 | in.readFully(content); |
| 121 | |
| 122 | contentType = Text.readString(in); // read contentType |
| 123 | // reconstruct metadata |
| 124 | int keySize = in.readInt(); |
| 125 | String key; |
| 126 | for (int i = 0; i < keySize; i++) { |
| 127 | key = Text.readString(in); |
| 128 | int valueSize = in.readInt(); |
| 129 | for (int j = 0; j < valueSize; j++) { |
| 130 | metadata.add(key, Text.readString(in)); |
| 131 | } |
| 132 | } |
| 133 | break; |
| 134 | case 2: |
| 135 | url = Text.readString(in); // read url |
| 136 | base = Text.readString(in); // read base |
| 137 | |
| 138 | content = new byte[in.readInt()]; // read content |
| 139 | in.readFully(content); |
| 140 | |
| 141 | contentType = Text.readString(in); // read contentType |
| 142 | metadata.readFields(in); // read meta data |
| 143 | break; |
| 144 | default: |
| 145 | throw new VersionMismatchException((byte) 2, oldVersion); |
| 146 | } |
| 147 | |
| 148 | } |
| 149 | |
| 150 | public final void readFields(DataInput in) throws IOException { |
| 151 | metadata.clear(); |
no test coverage detected