Examples of Base64Exception


Examples of org.apache.cxf.common.util.Base64Exception

                                   int l,
                                   OutputStream ostream) throws Base64Exception {
        try {
            ostream.write(new String(encodeChunk(id, o, l)).getBytes());
        } catch (IOException e) {
            throw new Base64Exception(new Message("BASE64_ENCODE_IOEXCEPTION", LOG), e);
        }
    }
View Full Code Here

Examples of org.apache.cxf.common.util.Base64Exception

                              int l,
                              Writer writer) throws Base64Exception {
        try {
            writer.write(encodeChunk(id, o, l));
        } catch (IOException e) {
            throw new Base64Exception(new Message("BASE64_ENCODE_WRITER_IOEXCEPTION", LOG), e);
        }
    }
View Full Code Here

Examples of org.wiztools.restclient.Base64Exception

        return Base64.encodeBase64String(arr);
    }
   
    public static byte[] base64decodeByteArray(String base64Str) throws Base64Exception {
        if(!Base64.isBase64(base64Str)) {
            throw new Base64Exception("Provided string is not Base64 encoded");
        }
        byte[] out = Base64.decodeBase64(base64Str);
        return out;
    }
View Full Code Here

Examples of org.wiztools.restclient.Base64Exception

        return out;
    }
   
    public static String base64decode(String base64Str) throws Base64Exception {
        if(!Base64.isBase64(base64Str)) {
            throw new Base64Exception("Provided string is not Base64 encoded");
        }
        byte[] out = base64decodeByteArray(base64Str);
        CharsetDecoder decoder = Charsets.UTF_8.newDecoder();
        try {
            decoder.onMalformedInput(CodingErrorAction.REPORT);
            decoder.onUnmappableCharacter(CodingErrorAction.REPORT);
            CharBuffer buffer = decoder.decode(
                    ByteBuffer.wrap(Arrays.copyOf(out, out.length)));
            return buffer.toString();
        }
        catch(MalformedInputException ex) {
            throw new Base64Exception("Input is malformed", ex);
        }
        catch(UnmappableCharacterException ex) {
            throw new Base64Exception("Unmappable characters found", ex);
        }
        catch(CharacterCodingException ex) {
            throw new Base64Exception(ex);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.