import java.io.FileInputStream;
import java.io.IOException;
public class KrcText
{
private static final char [] miarry = {'@', 'G', 'a', 'w', '^', '2 ',' t ', < br />'G', 'Q', '6 ', '1', '-', 'Î', 'Ò', 'n', 'i'};
public static void main (String [] args) throws IOException
{
The full path plus the file name
String filenm = "" ;/ / krc fileSystem.out.println (. New KrcText () getKrcText (filenm));
}
/ **
*
* @ Param filenm krc file path plus the file name
* @ Return krc text
file after processing* @ Throws IOException
* /
public String getKrcText (String filenm) throws IOException
{
File krcfile = new File (filenm);
byte [] zip_byte = new byte [(int) krcfile.length ()];
FileInputStream fileinstrm = new FileInputStream (krcfile);
byte [] top = new byte [4];
fileinstrm.read (top);
fileinstrm.read (zip_byte);
int j = zip_byte.length;
for (int k = 0; k
int l = k% 16;
int tmp67_65 = k;
byte [] tmp67_64 = zip_byte;
tmp67_64 [tmp67_65] = (byte) (tmp67_64 [tmp67_65] ^ miarry [l]);
}
String krc_text = new String (ZLibUtils.decompress (zip_byte), "utf-8");
return krc_text;
}
}
The red part of this approach, see if there is a way to convert wood into the iphone can be used directly. . Thank you ^ ^! ~ This code is used to resolve krc lyrics
Reply:
void getKrcText (const char * pszFilePath)
{
char szMiarry [] = {'@', 'G', 'a', 'w', '^', '2 ',' t ',' G ',' Q ', '6', '1 ', '-', 'Î', 'Ò', 'n', 'i'};
FILE * fp = :: fopen (pszFilePath, "rb");
:: Fseek (fp, SEEK_SET, SEEK_END);
int nFileLength = :: ftell (fp);
:: Fseek (fp, SEEK_SET, SEEK_SET);
char * pTop = new char [4];
char * pFileData = new char [nFileLength-4];
:: Fread (pTop, 1, 4, fp);
int nRead = 0;
for (; nRead{
int nCurRead = :: fread (pFileData + nRead, 1, nFileLength - 4 - nRead, fp);
nRead + = nCurRead;
}
for (int k = 0; k{
int j = k% 16;
pFileData [k] ^ = szMiarry [j];
}
/ / Zip decompression, decompression requires specialized library
}
I can help you write a piece of data is read, zip unzip this requires you to find a decoding library to decode.
const char * pszFilePath: an absolute file path + filename
LZ If no point C / C + +-based, it is estimated not good integration into your code. Do not have linux, no max ox, this code is compiled on the windows, the pure standard C code, it should be universal.
Reply:
char * pTop = new char [4];
char * pFileData = new char [nFileLength-4];
Treatment finished, remember to delete.
Reply:
Upstairs powerful ah.
No comments:
Post a Comment