Code example for UnsupportedEncodingException

Methods: toString

0
    private void setString(int offset, int maxLength, String theString) {
        byte[] stringBytes;
        try { 
            stringBytes = theString.getBytes("ISO8859_1"); //$NON-NLS-1$
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e.toString());
        } 
        int length = Math.min(stringBytes.length, maxLength);
        System.arraycopy(stringBytes, 0, buffer, offset, length);
        buffer[offset + length] = 0;
    } 
 
    /** 
     * Set the SOCKS version number. This should always be 4. 
     */ 
    private void setVersionNumber(int number) {
        buffer[INDEX_VERSION] = (byte) number;
    } 
}