1202 } |
1202 } |
1203 |
1203 |
1204 private void writeApplicationExtension(GIFWritableImageMetadata im) |
1204 private void writeApplicationExtension(GIFWritableImageMetadata im) |
1205 throws IOException { |
1205 throws IOException { |
1206 if (im.applicationIDs != null) { |
1206 if (im.applicationIDs != null) { |
1207 Iterator iterIDs = im.applicationIDs.iterator(); |
1207 Iterator<byte[]> iterIDs = im.applicationIDs.iterator(); |
1208 Iterator iterCodes = im.authenticationCodes.iterator(); |
1208 Iterator<byte[]> iterCodes = im.authenticationCodes.iterator(); |
1209 Iterator iterData = im.applicationData.iterator(); |
1209 Iterator<byte[]> iterData = im.applicationData.iterator(); |
1210 |
1210 |
1211 while (iterIDs.hasNext()) { |
1211 while (iterIDs.hasNext()) { |
1212 try { |
1212 try { |
1213 stream.write(0x21); |
1213 stream.write(0x21); |
1214 stream.write(0xff); |
1214 stream.write(0xff); |
1215 |
1215 |
1216 stream.write(11); |
1216 stream.write(11); |
1217 stream.write((byte[])iterIDs.next(), 0, 8); |
1217 stream.write(iterIDs.next(), 0, 8); |
1218 stream.write((byte[])iterCodes.next(), 0, 3); |
1218 stream.write(iterCodes.next(), 0, 3); |
1219 |
1219 |
1220 writeBlocks((byte[])iterData.next()); |
1220 writeBlocks(iterData.next()); |
1221 |
1221 |
1222 stream.write(0x00); |
1222 stream.write(0x00); |
1223 } catch (IOException e) { |
1223 } catch (IOException e) { |
1224 throw new IIOException("I/O error writing Application Extension!", e); |
1224 throw new IIOException("I/O error writing Application Extension!", e); |
1225 } |
1225 } |
1229 |
1229 |
1230 private void writeCommentExtension(GIFWritableImageMetadata im) |
1230 private void writeCommentExtension(GIFWritableImageMetadata im) |
1231 throws IOException { |
1231 throws IOException { |
1232 if (im.comments != null) { |
1232 if (im.comments != null) { |
1233 try { |
1233 try { |
1234 Iterator iter = im.comments.iterator(); |
1234 Iterator<byte[]> iter = im.comments.iterator(); |
1235 while (iter.hasNext()) { |
1235 while (iter.hasNext()) { |
1236 stream.write(0x21); |
1236 stream.write(0x21); |
1237 stream.write(0xfe); |
1237 stream.write(0xfe); |
1238 writeBlocks((byte[])iter.next()); |
1238 writeBlocks(iter.next()); |
1239 stream.write(0x00); |
1239 stream.write(0x00); |
1240 } |
1240 } |
1241 } catch (IOException e) { |
1241 } catch (IOException e) { |
1242 throw new IIOException("I/O error writing Comment Extension!", e); |
1242 throw new IIOException("I/O error writing Comment Extension!", e); |
1243 } |
1243 } |