Sets the maximum number of cookies that can be stored. @param limit the maximum number of cookies, or -1 for no limit
(int limit)
| 96 | * @param limit the maximum number of cookies, or -1 for no limit |
| 97 | */ |
| 98 | public void setLimit(int limit) { |
| 99 | this.limit = limit; |
| 100 | if (limit > -1 && serverCookies.length > limit && cookieCount <= limit) { |
| 101 | // shrink cookie list array |
| 102 | ServerCookie[] scookiesTmp = new ServerCookie[limit]; |
| 103 | System.arraycopy(serverCookies, 0, scookiesTmp, 0, cookieCount); |
| 104 | serverCookies = scookiesTmp; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | |
| 109 | /** |