Is there some library or built-in funcionality in J2ME to compress a byte array trough ZIP?
I'd like to do something like this:
byte[] data;
byte[] compressed = ZIPLibrary.compress(data);
Thanks.
May I suggest http://code.google.com/p/compress-j2me/
Related
var imgStr= new Buffer.from(img).toString('base64');
I have been using this, but it is not working. This is the code to convert the screenshot i have taken into base64 encoding.
You don't need to use new
var imgStr = Buffer.from(imgBuffer).toString('base64');
Is there a way to read a file in adobe extendscript to bytearray? I will upload
the bytes to a rest server.
Currently, i'm using below and it is giving me binary string.
var s = file.read();
Not really. The JavaScript interpreter ExtendScript is based on pre-dates the typed array datatypes. You'll have to work with the binary string.
I need to decode amr format to pcm format, which is later converted to mp3 using c#.net. But I am hardly finding any library to do so. It seems with NAudio it is not possible. Is there any c# based open source library which can be used to decode this format files?. Presently I am working on windows server 2012(64 bit).
NAudio Code:
public void Decode()
{
.....
var result= new MediaFoundationReader("..\\sample.amr");
// later converted to mp3 here
}
It looks you two guys are doing the same thing: How to convert amr files to mp3 using C#
You typically need to have a [third party] AMR decoder installed and integrated into Windows API (ACM, DirectShow, Media Foundation). Then you will use your favorite library around this API, such as NAudio.
Example of AMR decoder: MONOGRAM AMR Pack.
You're unlikely to find a C# decoder for AMR files. I'd recommend just finding a command-line utility that you can call to convert to PCM. For example, it looks like sox can be used to decode AMR.
I have a text file, that contains 50,000 lines of "strange" text:
UEsDBBQAAgAIACaOVEA6e5H83pcBAMLBAQArAAAAW1NhbXN1
bmddIC0gVGVzdCB0YXNrIC0gU291bmQgZGVjcnlwdG9yLnBu
Z+z9ZVBcXdcFiia4B/cgTQPBJTgEC9bBEtwCBCe4uwVtNN24
QyAQ3C24OwR3d3e303zv++T57vl5761zbt06VV3V1bLWXjLX
mGOuNcfe4I8K0phopGgvXrzABMlIKL14AY/x4gUCKQoc7Jsv
3GZA2NtLByVp8RfFQ+Q7sA8IpmLyYi9elEWh339BhH2mMpRR
kn/xwp3uxQvfgBcvbmFf+W6/eOHE/uLFrv6LFwIJL14Q2ab8
/iT04sVTJEhCTMVVdz8VMUW18+6JF1Rfv2fh4uISpoGCAsUN
pWIMRfz169f0L99Rmdw3aDKaMWgoxCFFGT8qD5+8rkZuBp86
FupLdS4PvYcs9GwP5/nfDjfkCm8l1m0ZEeHjG+1gv8T5+0LB
FgX+n77owcX59yO2H/tLMLAK7d9vQqioINkm1HAAqv++cEFf
4f9+AHwnfekGVVrL1vj71Ua4r4QSf4EtgTqChOj/vKi4YYXy
7JSY/17EXkoUkJeiWhvK9L/qAWeP8zHEoYT4/s9LlJ+GCqIy
xKjTSfBPU2QiYDV/TcGX/afijBSc7zKMpgTFq6G+/y2XDauZ
gVshlPafij8OocgAYyvQ1O0kRf9bTglWcwwpfSfuPxW/MUUA
Qvs0Awtq//YiD1bzh4hoA/A/Fce8hXVio7BNVedvL8ZhNf/s
ApVJ/FNxHwmsE/ZqK4zFf3vxFVbz/+fD8yTi1xn2lPDWdMXj
aJBUyKivv6TB6wn+wcb89pRA3VHgoTL3cu4IsuDiw8dbIql2
OAhu3teuKD/s6/tNbwcd215q3qfT1GRBa7+hgaNMJkjDnoY2
98VqH9VtwdOnXV9j8jaMXzY1vfNoFHTaNZWNu/90uycGyDuf
gjDj/7dJuDSlnjd9/BVEjSM2u2OKkdaT6xN7xTue
And at this moment, I don't know how to process this text. Effectively it reads like puzzle text.
What is it?
This is a Base64 encoding of a PNG file called Sound decryptor.png.
Use any Base64 decoder to convert it to a file... Such as this one: http://download.cnet.com/Base64-Encoder-Decoder/3000-10250_4-10555647.html
This is Base64 encoded data.
The particular snippet in your question looks like the beginning of a ZIP-file (begins with the typical PK).
This is a base64-encoded ZIP archive, here's the start of it: PK...T#:{‘...[Samsung] - Test task - Sound decryptor.png.... (contains a PNG image, perhaps something else).
This seems to be a Base64 encoded PNG file. Could you post the entire file so we're able to try to decode it?
This looks like Base64 encoded text. Depending on the programming language you use, you should be able to find a function to decode it for you.
For Python, use base64.b64decode(text). For PHP, use base64_decode($text). Other environment have similar facilities.
Do this to decode the Base64 encoded data:
$ base64 -d original.file
P&T#:{üޗÂÁ+[Samsung] - Test task - Sound decryptor.pngìýeP\]×&¸÷ MÁ%8
(...)
$ base64 -d original.file > decoded.file
$ file decoded.file
decoded.file: Zip archive data
As it turns out to be a ZIP file, it can be unzipped by:
$ unzip decoded.file
Command base64 is in coreutils.
I am using jazzlib package in j2me application to compress the xml file in zip format using ZipOutputStream and the send the compress stream to the server as a string . I am able to do unzip the in mobile using ZipInputStream. But in server i am not able to unzip , i got
EOF exception. when i copy the compressed stream from console and put into browser, the empty space put special character like [] in compressed stream. I didnt understand what happened. Plz help
You send the compressed stream as a String? That's your problem(s) right there:
compressed data is binary data (i.e. byte[]).
String is designed to handle textual (Unicode) data and not arbitrary binary data
converting arbitrary binary data to String is bound to lead to problems
So if you want to handle (send/receive/...) binary data, make sure you never use a String/Reader/Writer to handle the data anywhere in the process. Stay with byte[]/InputStream/OutputStream.