Questions tagged [apache-commons-codec]

Apache Commons Codec provides implementations of common encoders and decoders such as Base64, Hex, Phonetic and URLs.

Apache Commons Codec was originally designed to be the definitive Base64 encoder, as there existed many different implementations.

While this package contains an abstract framework for the creation of encoders and decoders, Codec itself is primarily focused on providing functional utilities for working with common encodings.

http://commons.apache.org/proper/commons-codec/

63 questions
53
votes
11 answers

Apache Commons Codec with Android: could not find method

Today I tried including the apache.commons.codec package in my Android application and couldn't get it running. Android could not find method ord.apache.commons.codec.binary.* and output the following errors in DDMS 01-12 08:41:48.161:…
dqminh
  • 1,545
  • 1
  • 13
  • 9
32
votes
2 answers

How to decode JWT (Header and Body) in java using Apache Commons Codec?

I am looking decode the following JWT using Apache Commons Codec. How we can do that ? …
user4821194
16
votes
4 answers

NoSuchMethodError using commonc codec in Android application

I added the commons codec from apache.org (commons-codec-1.4.jar) in eclipse for my Android application following the instruction here. There is no error in the code. But when I run the application and call the function that use the codec the…
DVV
  • 161
  • 1
  • 1
  • 3
16
votes
1 answer

Showing Base64String Image with Thymeleaf

I am storing jpg images in a database (as byte array). I want to avoid dropping onto filesystem before showing on a web page. Unit Tests show that database storage and retrieval are working without corruption. Fies can be extracted from database and…
Jake
  • 4,322
  • 6
  • 39
  • 83
9
votes
3 answers

How to convert sun.misc.BASE64Encoder to org.apache.commons.codec.binary.Base64

I have the following code for sun.misc.BASE64Encoder: BASE64Decoder decoder = new BASE64Decoder(); byte[] saltArray = decoder.decodeBuffer(saltD); byte[] ciphertextArray = decoder.decodeBuffer(ciphertext); and would like to convert it to…
Stephane Grenier
  • 15,527
  • 38
  • 117
  • 192
8
votes
3 answers

why apache-commons lib encoding space as + not as %20?

i'm using URLCodec from Apache Commons Codec to encode URL, but it encode space as + NOT as %20 why? and what is the solution?
Adham
  • 63,550
  • 98
  • 229
  • 344
8
votes
5 answers

How to resolve a library conflict (apache commons-codec)

I have a problem with Android libraries. I would like use the method Hex.encodeHexString(Byte Array) from the library org.apache.commons.codec.binary.Hex (version 1.6) On my Android platform (SDK 2.3.1), the commons-codec library version 1.3…
nbe_42
  • 1,212
  • 1
  • 14
  • 22
5
votes
3 answers

Base64-encode a file and compress it

My goal is to encode a file and zip it in a folder in java. I have to use the Apache's Commons-codec library. I am able to encode and zip it and it works fine but when i decode it back to its original form, it looks like the file has not completely…
dmurali
  • 211
  • 1
  • 6
  • 14
5
votes
2 answers

How efficient is the encoding/decoding algorithm of BASE64 class in Java?

I am about to use an algorithm to encode a variable length but very long String field retrieved from an XML file, then that encoded data should be persisted in the database. Later, when I recieve a second file I need to fetch the encoded data from…
5
votes
1 answer

Maven package org.apache.commons.codec.binary does not exist

Running: mvn compile Generates error: package org.apache.commons.codec.binary does not exist pom.xml includes: commons-codec commons-codec 1.10
KevinC
  • 115
  • 1
  • 1
  • 8
5
votes
3 answers

UNRESOLVED DEPENDENCIES for commons-codec

I'm trying to retrieve the library for Google Reporting API: compile 'com.google.apis:google-api-services-analytics:v3-rev74-1.17.0-rc' but I got an unresolved dependencies error and I don't know what to do with it: ::…
Lojza Ibg
  • 658
  • 9
  • 32
3
votes
1 answer

Base64 decoding using apache commons codec failing on very large binary file

I am developing an encryption tool, and for our encrypted file format I am using Base64 to encode data. I am using apache commons codec to decode files using a Base64InputStream wrapped around a FileInputStream. This worked like a charm until I…
Lily Chung
  • 2,919
  • 1
  • 25
  • 42
3
votes
2 answers

Hex encoded form of byte array different to same byte array “object” converted to byte array. Why?

This question is asked out of curiousity rather than any urgent need. I found some code to convert an object to a byte array (I thought I needed it at the time). Using commons-codec I noticed that the encoded Hex string representation of the pure…
Mark McLaren
  • 11,470
  • 2
  • 48
  • 79
3
votes
2 answers

Apache Commons Hex Encoding Error

I'm trying to use org.apache.commons.codec.binary.Hex to encode and decode a String value: e.g.: Hex.encodeHex("10".getBytes()).toString(); However, this is not giving me a hexadecimal output, but outputs similar to this: [C@596d444a Any ideas…
amaseuk
  • 2,147
  • 4
  • 24
  • 43
3
votes
1 answer

base64 url safe removes =

The following code(using commons codec Base64): byte[] a = Hex.decodeHex("9349c513ed080dab".toCharArray()); System.out.println(Base64.encodeBase64URLSafeString(a)); System.out.println(Base64.encodeBase64String(a)); gives the following…
Pankaj Singhal
  • 15,283
  • 9
  • 47
  • 86
1
2 3 4 5