1 10 11 60 61 package org.mule.util; 62 63 import java.io.BufferedInputStream ; 64 import java.io.ByteArrayInputStream ; 65 import java.io.File ; 66 import java.io.FileInputStream ; 67 import java.io.FileOutputStream ; 68 import java.io.FilterInputStream ; 69 import java.io.FilterOutputStream ; 70 import java.io.IOException ; 71 import java.io.ObjectInputStream ; 72 import java.io.ObjectOutputStream ; 73 import java.io.Serializable ; 74 import java.io.UnsupportedEncodingException ; 75 import java.util.zip.GZIPInputStream ; 76 import java.util.zip.GZIPOutputStream ; 77 78 import org.apache.commons.io.IOUtils; 79 import org.apache.commons.io.output.ByteArrayOutputStream; 80 81 public class Base64 82 { 83 84 85 86 87 public final static int NO_OPTIONS = 0; 88 89 90 public final static int ENCODE = 1; 91 92 93 public final static int DECODE = 0; 94 95 96 public final static int GZIP = 2; 97 98 99 public final static int DONT_BREAK_LINES = 8; 100 101 102 public final static String PREFERRED_ENCODING = "UTF-8"; 103 104 105 106 107 private final static int MAX_LINE_LENGTH = 76; 108 109 110 private final static byte EQUALS_SIGN = (byte)'='; 111 112 113 private final static byte NEW_LINE = (byte)'\n'; 114 115 116 private final static byte[] ALPHABET; 117 118 private final static byte[] _NATIVE_ALPHABET = 119 120 {(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', (byte)'H', (byte)'I', 121 (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O', (byte)'P', (byte)'Q', (byte)'R', 122 (byte)'S', (byte)'T', (byte)'U', (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', (byte)'a', 123 (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', (byte)'h', (byte)'i', (byte)'j', 124 (byte)'k', (byte)'l', (byte)'m', (byte)'n', (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', 125 (byte)'t', (byte)'u', (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', (byte)'0', (byte)'1', 126 (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', 127 (byte)'/'}; 128 129 130 static 131 { 132 byte[] __bytes; 133 try 134 { 135 __bytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes(PREFERRED_ENCODING); 136 } catch (java.io.UnsupportedEncodingException use) 138 { 139 __bytes = _NATIVE_ALPHABET; } ALPHABET = __bytes; 142 } 144 148 private final static byte[] DECODABET = {-9, -9, -9, -9, -9, -9, -9, -9, -9, -5, -5, -9, -9, -5, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -5, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, 62, -9, -9, -9, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -9, -9, -9, -1, -9, -9, -9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -9, -9, -9, -9, -9, -9, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -9, -9, -9, -9 185 }; 186 187 private final static byte WHITE_SPACE_ENC = -5; private final static byte EQUALS_SIGN_ENC = -1; 194 196 197 private Base64() 198 { 199 super(); 200 } 201 202 203 204 217 private static byte[] encode3to4(byte[] b4, byte[] threeBytes, int numSigBytes) 218 { 219 encode3to4(threeBytes, 0, numSigBytes, b4, 0); 220 return b4; 221 } 223 241 private static byte[] encode3to4(byte[] source, 242 int srcOffset, 243 int numSigBytes, 244 byte[] destination, 245 int destOffset) 246 { 247 254 int inBuff = (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8) : 0) 260 | (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16) : 0) 261 | (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24) : 0); 262 263 switch (numSigBytes) 264 { 265 case 3 : 266 destination[destOffset] = ALPHABET[(inBuff >>> 18)]; 267 destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f]; 268 destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f]; 269 destination[destOffset + 3] = ALPHABET[(inBuff) & 0x3f]; 270 return destination; 271 272 case 2 : 273 destination[destOffset] = ALPHABET[(inBuff >>> 18)]; 274 destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f]; 275 destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f]; 276 destination[destOffset + 3] = EQUALS_SIGN; 277 return destination; 278 279 case 1 : 280 destination[destOffset] = ALPHABET[(inBuff >>> 18)]; 281 destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f]; 282 destination[destOffset + 2] = EQUALS_SIGN; 283 destination[destOffset + 3] = EQUALS_SIGN; 284 return destination; 285 286 default : 287 return destination; 288 } } 291 301 public static String encodeObject(Serializable serializableObject) throws IOException 302 { 303 return encodeObject(serializableObject, NO_OPTIONS); 304 } 306 332 public static String encodeObject(Serializable serializableObject, int options) throws IOException 333 { 334 ByteArrayOutputStream baos = null; 336 OutputStream b64os = null; 337 ObjectOutputStream oos = null; 338 GZIPOutputStream gzos = null; 339 340 int gzip = (options & GZIP); 342 int dontBreakLines = (options & DONT_BREAK_LINES); 343 344 try 345 { 346 baos = new ByteArrayOutputStream(4096); 348 b64os = new Base64.OutputStream(baos, ENCODE | dontBreakLines); 349 350 if (gzip == GZIP) 352 { 353 gzos = new GZIPOutputStream (b64os); 354 oos = new ObjectOutputStream (gzos); 355 } else 357 { 358 oos = new ObjectOutputStream (b64os); 359 } 360 361 oos.writeObject(serializableObject); 362 363 if (gzos != null) 364 { 365 gzos.finish(); 366 gzos.close(); 367 } 368 369 oos.close(); 370 } catch (IOException e) 372 { 373 return null; 374 } finally 376 { 377 IOUtils.closeQuietly(oos); 378 IOUtils.closeQuietly(gzos); 379 IOUtils.closeQuietly(b64os); 380 IOUtils.closeQuietly(baos); 381 } 383 try 385 { 386 return new String (baos.toByteArray(), PREFERRED_ENCODING); 387 } catch (UnsupportedEncodingException uue) 389 { 390 return new String (baos.toByteArray()); 391 } 393 } 395 401 public static String encodeBytes(byte[] source) throws IOException 402 { 403 return encodeBytes(source, 0, source.length, NO_OPTIONS); 404 } 406 429 public static String encodeBytes(byte[] source, int options) throws IOException 430 { 431 return encodeBytes(source, 0, source.length, options); 432 } 434 442 public static String encodeBytes(byte[] source, int off, int len) throws IOException 443 { 444 return encodeBytes(source, off, len, NO_OPTIONS); 445 } 447 472 public static String encodeBytes(byte[] source, int off, int len, int options) throws IOException 473 { 474 int dontBreakLines = (options & DONT_BREAK_LINES); 476 int gzip = (options & GZIP); 477 478 if (gzip == GZIP) 480 { 481 ByteArrayOutputStream baos = null; 482 GZIPOutputStream gzos = null; 483 Base64.OutputStream b64os = null; 484 485 try 486 { 487 baos = new ByteArrayOutputStream(4096); 489 b64os = new Base64.OutputStream(baos, ENCODE | dontBreakLines); 490 gzos = new GZIPOutputStream (b64os); 491 492 gzos.write(source, off, len); 493 gzos.finish(); 494 gzos.close(); 495 } catch (IOException e) 497 { 498 throw e; 499 } finally 501 { 502 IOUtils.closeQuietly(gzos); 503 IOUtils.closeQuietly(b64os); 504 IOUtils.closeQuietly(baos); 505 } 507 try 509 { 510 return new String (baos.toByteArray(), PREFERRED_ENCODING); 511 } catch (UnsupportedEncodingException uue) 513 { 514 return new String (baos.toByteArray()); 515 } } 518 else 520 { 521 boolean breakLines = dontBreakLines == 0; 523 524 int len43 = len * 4 / 3; 525 byte[] outBuff = new byte[(len43) + ((len % 3) > 0 ? 4 : 0) + (breakLines ? (len43 / MAX_LINE_LENGTH) : 0)]; 531 int d = 0; 532 int e = 0; 533 int len2 = len - 2; 534 int lineLength = 0; 535 for (; d < len2; d += 3, e += 4) 536 { 537 encode3to4(source, d + off, 3, outBuff, e); 538 539 lineLength += 4; 540 if (breakLines && lineLength == MAX_LINE_LENGTH) 541 { 542 outBuff[e + 4] = NEW_LINE; 543 e++; 544 lineLength = 0; 545 } } 548 if (d < len) 549 { 550 encode3to4(source, d + off, len - d, outBuff, e); 551 e += 4; 552 } 554 try 556 { 557 return new String (outBuff, 0, e, PREFERRED_ENCODING); 558 } catch (UnsupportedEncodingException uue) 560 { 561 return new String (outBuff, 0, e); 562 } 564 } 566 } 568 569 570 587 private static int decode4to3(byte[] source, int srcOffset, byte[] destination, int destOffset) 588 { 589 if (source[srcOffset + 2] == EQUALS_SIGN) 591 { 592 int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) 597 | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12); 598 599 destination[destOffset] = (byte)(outBuff >>> 16); 600 return 1; 601 } 602 603 else if (source[srcOffset + 3] == EQUALS_SIGN) 605 { 606 int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) 612 | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) 613 | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6); 614 615 destination[destOffset] = (byte)(outBuff >>> 16); 616 destination[destOffset + 1] = (byte)(outBuff >>> 8); 617 return 2; 618 } 619 620 else 622 { 623 try 624 { 625 int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) 633 | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) 634 | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6) 635 | ((DECODABET[source[srcOffset + 3]] & 0xFF)); 636 637 destination[destOffset] = (byte)(outBuff >> 16); 638 destination[destOffset + 1] = (byte)(outBuff >> 8); 639 destination[destOffset + 2] = (byte)(outBuff); 640 641 return 3; 642 } 643 catch (Exception e) 644 { 645 StringBuffer msg = new StringBuffer (64); 647 msg.append(source[srcOffset]).append(": ").append(DECODABET[source[srcOffset]]); 648 msg.append(source[srcOffset + 1]).append(": ").append(DECODABET[source[srcOffset + 1]]); 649 msg.append(source[srcOffset + 2]).append(": ").append(DECODABET[source[srcOffset + 2]]); 650 msg.append(source[srcOffset + 3]).append(": ").append(DECODABET[source[srcOffset + 3]]); 651 throw new IllegalStateException (msg.toString()); 652 } } 654 } 656 667 public static byte[] decode(byte[] source, int off, int len) 668 { 669 int len34 = len * 3 / 4; 670 byte[] outBuff = new byte[len34]; int outBuffPosn = 0; 672 673 byte[] b4 = new byte[4]; 674 int b4Posn = 0; 675 int i = 0; 676 byte sbiCrop = 0; 677 byte sbiDecode = 0; 678 for (i = off; i < off + len; i++) 679 { 680 sbiCrop = (byte)(source[i] & 0x7f); sbiDecode = DECODABET[sbiCrop]; 682 683 if (sbiDecode >= WHITE_SPACE_ENC) { 686 if (sbiDecode >= EQUALS_SIGN_ENC) 687 { 688 b4[b4Posn++] = sbiCrop; 689 if (b4Posn > 3) 690 { 691 outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn); 692 b4Posn = 0; 693 694 if (sbiCrop == EQUALS_SIGN) break; 696 } 698 } 700 } else 702 { 703 throw new IllegalArgumentException ("Bad Base64 input character at " + i + ": " + source[i] 704 + "(decimal)"); 705 } } 708 byte[] out = new byte[outBuffPosn]; 709 System.arraycopy(outBuff, 0, out, 0, outBuffPosn); 710 return out; 711 } 713 721 public static byte[] decode(String s) 722 { 723 byte[] bytes; 724 try 725 { 726 bytes = s.getBytes(PREFERRED_ENCODING); 727 } catch (UnsupportedEncodingException uee) 729 { 730 bytes = s.getBytes(); 731 } 734 bytes = decode(bytes, 0, bytes.length); 736 737 if (bytes != null && bytes.length >= 4) 740 { 741 742 int head = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00); 743 if (GZIPInputStream.GZIP_MAGIC == head) 744 { 745 ByteArrayInputStream bais = null; 746 GZIPInputStream gzis = null; 747 ByteArrayOutputStream baos = null; 748 byte[] buffer = new byte[4096]; 749 int length = 0; 750 751 try 752 { 753 baos = new ByteArrayOutputStream(4096); 754 bais = new ByteArrayInputStream (bytes); 755 gzis = new GZIPInputStream (bais); 756 757 while ((length = gzis.read(buffer)) >= 0) 758 { 759 baos.write(buffer, 0, length); 760 } 762 bytes = baos.toByteArray(); 764 765 } catch (IOException e) 767 { 768 } finally 771 { 772 IOUtils.closeQuietly(baos); 773 IOUtils.closeQuietly(gzis); 774 IOUtils.closeQuietly(bais); 775 } 777 } } 780 return bytes; 781 } 783 791 public static Object decodeToObject(String encodedObject) throws IOException , ClassNotFoundException 792 { 793 byte[] objBytes = decode(encodedObject); 795 796 ByteArrayInputStream bais = null; 797 ObjectInputStream ois = null; 798 Object obj = null; 799 800 try 801 { 802 bais = new ByteArrayInputStream (objBytes); 803 ois = new ObjectInputStream (bais); 804 obj = ois.readObject(); 805 } catch (IOException e) 807 { 808 throw e; 809 } catch (java.lang.ClassNotFoundException e) 811 { 812 throw e; 813 } finally 815 { 816 IOUtils.closeQuietly(bais); 817 IOUtils.closeQuietly(ois); 818 } 820 return obj; 821 } 823 830 public static void encodeToFile(byte[] dataToEncode, String filename) throws IOException 831 { 832 Base64.OutputStream bos = null; 833 834 try 835 { 836 bos = new Base64.OutputStream(new FileOutputStream (filename), Base64.ENCODE); 837 bos.write(dataToEncode); 838 } catch (IOException e) 840 { 841 throw e; 842 } finally 844 { 845 IOUtils.closeQuietly(bos); 846 } } 849 856 public static void decodeToFile(String dataToDecode, String filename) throws IOException 857 { 858 Base64.OutputStream bos = null; 859 860 try 861 { 862 bos = new Base64.OutputStream(new FileOutputStream (filename), Base64.DECODE); 863 bos.write(dataToDecode.getBytes(PREFERRED_ENCODING)); 864 } catch (IOException e) 866 { 867 throw e; 868 } finally 870 { 871 IOUtils.closeQuietly(bos); 872 } } 875 882 public static byte[] decodeFromFile(String filename) throws IOException 883 { 884 byte[] decodedData = null; 885 Base64.InputStream bis = null; 886 887 try 888 { 889 File file = FileUtils.newFile(filename); 891 byte[] buffer = null; 892 int length = 0; 893 int numBytes = 0; 894 895 if (file.length() > Integer.MAX_VALUE) 897 { 898 throw new IllegalArgumentException ("File is too big for this convenience method (" 899 + file.length() + " bytes)."); 900 } buffer = new byte[(int)file.length()]; 902 903 bis = new Base64.InputStream(new BufferedInputStream (new FileInputStream (file)), Base64.DECODE); 905 906 while ((numBytes = bis.read(buffer, length, 4096)) >= 0) 908 { 909 length += numBytes; 910 } 911 912 decodedData = new byte[length]; 914 System.arraycopy(buffer, 0, decodedData, 0, length); 915 } catch (IOException e) 917 { 918 throw e; 919 } finally 921 { 922 IOUtils.closeQuietly(bis); 923 } 925 return decodedData; 926 } 928 935 public static String encodeFromFile(String filename) throws IOException 936 { 937 String encodedData = null; 938 Base64.InputStream bis = null; 939 940 try 941 { 942 File file = FileUtils.newFile(filename); 944 byte[] buffer = new byte[(int)(file.length() * 1.4)]; 945 int length = 0; 946 int numBytes = 0; 947 948 bis = new Base64.InputStream(new BufferedInputStream (new FileInputStream (file)), Base64.ENCODE); 950 951 while ((numBytes = bis.read(buffer, length, 4096)) >= 0) 953 { 954 length += numBytes; 955 } 956 957 encodedData = new String (buffer, 0, length, Base64.PREFERRED_ENCODING); 959 } catch (IOException e) 961 { 962 throw e; 963 } finally 965 { 966 IOUtils.closeQuietly(bis); 967 } 969 return encodedData; 970 } 972 973 974 982 public static class InputStream extends FilterInputStream 983 { 984 private boolean encode; private int position; private byte[] buffer; private int bufferLength; private int numSigBytes; private int lineLength; 990 private boolean breakLines; 992 998 public InputStream(java.io.InputStream in) 999 { 1000 this(in, DECODE); 1001 } 1003 1025 public InputStream(java.io.InputStream in, int options) 1026 { 1027 super(in); 1028 this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES; 1029 this.encode = (options & ENCODE) == ENCODE; 1030 this.bufferLength = encode ? 4 : 3; 1031 this.buffer = new byte[bufferLength]; 1032 this.position = -1; 1033 this.lineLength = 0; 1034 } 1036 1043 public int read() throws IOException 1044 { 1045 if (position < 0) 1047 { 1048 if (encode) 1049 { 1050 byte[] b3 = new byte[3]; 1051 int numBinaryBytes = 0; 1052 for (int i = 0; i < 3; i++) 1053 { 1054 try 1055 { 1056 int b = in.read(); 1057 1058 if (b >= 0) 1060 { 1061 b3[i] = (byte)b; 1062 numBinaryBytes++; 1063 } 1065 } catch (IOException e) 1067 { 1068 if (i == 0) throw e; 1070 1071 } } 1074 if (numBinaryBytes > 0) 1075 { 1076 encode3to4(b3, 0, numBinaryBytes, buffer, 0); 1077 position = 0; 1078 numSigBytes = 4; 1079 } else 1081 { 1082 return -1; 1083 } } 1086 else 1088 { 1089 byte[] b4 = new byte[4]; 1090 int i = 0; 1091 for (i = 0; i < 4; i++) 1092 { 1093 int b = 0; 1095 do 1096 { 1097 b = in.read(); 1098 } 1099 while (b >= 0 && DECODABET[b & 0x7f] <= WHITE_SPACE_ENC); 1100 1101 if (b < 0) break; 1103 b4[i] = (byte)b; 1104 } 1106 if (i == 4) 1107 { 1108 numSigBytes = decode4to3(b4, 0, buffer, 0); 1109 position = 0; 1110 } else if (i == 0) 1112 { 1113 return -1; 1114 } else 1116 { 1117 throw new IOException ("Improperly padded Base64 input."); 1119 } 1121 } } 1124 if (position >= 0) 1126 { 1127 if ( position >= numSigBytes) return -1; 1129 1130 if (encode && breakLines && lineLength >= MAX_LINE_LENGTH) 1131 { 1132 lineLength = 0; 1133 return '\n'; 1134 } else 1136 { 1137 lineLength++; 1141 int b = buffer[position++]; 1142 1143 if (position >= bufferLength) position = -1; 1144 1145 return b & 0xFF; } } 1150 else 1152 { 1153 throw new IOException ("Error in Base64 code reading stream."); 1155 } } 1158 1169 public int read(byte[] dest, int off, int len) throws IOException 1170 { 1171 int i; 1172 int b; 1173 for (i = 0; i < len; i++) 1174 { 1175 b = read(); 1176 1177 1180 if (b >= 0) 1181 dest[off + i] = (byte)b; 1182 else if (i == 0) 1183 return -1; 1184 else 1185 break; } return i; 1188 } 1190 } 1192 1193 1194 1202 public static class OutputStream extends FilterOutputStream 1203 { 1204 private boolean encode; 1205 private int position; 1206 private byte[] buffer; 1207 private int bufferLength; 1208 private int lineLength; 1209 private boolean breakLines; 1210 private byte[] b4; private boolean suspendEncoding; 1212 1213 1219 public OutputStream(java.io.OutputStream out) 1220 { 1221 this(out, ENCODE); 1222 } 1224 1246 public OutputStream(java.io.OutputStream out, int options) 1247 { 1248 super(out); 1249 this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES; 1250 this.encode = (options & ENCODE) == ENCODE; 1251 this.bufferLength = encode ? 3 : 4; 1252 this.buffer = new byte[bufferLength]; 1253 this.position = 0; 1254 this.lineLength = 0; 1255 this.suspendEncoding = false; 1256 this.b4 = new byte[4]; 1257 } 1259 1268 public void write(int theByte) throws IOException 1269 { 1270 if (suspendEncoding) 1272 { 1273 super.out.write(theByte); 1274 return; 1275 } 1277 if (encode) 1279 { 1280 buffer[position++] = (byte)theByte; 1281 if (position >= bufferLength) { 1283 out.write(encode3to4(b4, buffer, bufferLength)); 1284 1285 lineLength += 4; 1286 if (breakLines && lineLength >= MAX_LINE_LENGTH) 1287 { 1288 out.write(NEW_LINE); 1289 lineLength = 0; 1290 } 1292 position = 0; 1293 } } 1296 else 1298 { 1299 if (DECODABET[theByte & 0x7f] > WHITE_SPACE_ENC) 1301 { 1302 buffer[position++] = (byte)theByte; 1303 if (position >= bufferLength) { 1305 int len = Base64.decode4to3(buffer, 0, b4, 0); 1306 out.write(b4, 0, len); 1307 position = 0; 1309 } } else if (DECODABET[theByte & 0x7f] != WHITE_SPACE_ENC) 1312 { 1313 throw new IOException ("Invalid character in Base64 data."); 1314 } } } 1318 1327 public void write(byte[] theBytes, int off, int len) throws IOException 1328 { 1329 if (suspendEncoding) 1331 { 1332 super.out.write(theBytes, off, len); 1333 return; 1334 } 1336 for (int i = 0; i < len; i++) 1337 { 1338 write(theBytes[off + i]); 1339 } 1341 } 1343 1347 public void flushBase64() throws IOException 1348 { 1349 if (position > 0) 1350 { 1351 if (encode) 1352 { 1353 out.write(encode3to4(b4, buffer, position)); 1354 position = 0; 1355 } else 1357 { 1358 throw new IOException ("Base64 input not properly padded."); 1359 } } 1362 } 1364 1369 public void close() throws IOException 1370 { 1371 flushBase64(); 1373 1374 super.close(); 1377 1378 buffer = null; 1379 out = null; 1380 } 1382 1388 public void suspendEncoding() throws IOException 1389 { 1390 flushBase64(); 1391 this.suspendEncoding = true; 1392 } 1394 1400 public void resumeEncoding() 1401 { 1402 this.suspendEncoding = false; 1403 } 1405 } 1407} | Popular Tags |