Jump to content
  • 0
manpaint55

How to comile java script?

Question

I need to compile or run this code to dump music

[CODE]import java.io.*;
import java.util.zip.GZIPInputStream;
public class MidiDumper {
private static final String folder = "C:\\WINDOWS\\.file_store_32\\runescape\\";
private static final String savefolder = "C:\\save\\";
private static DataInputStream cache;
public static void main(String args[]) throws Exception {
File f = new File(folder + "main_file_cache.dat2");
byte bytes[] = new byte[(int) f.length()];
new FileInputStream(f).read(bytes);
BufferedInputStream cache2 = new BufferedInputStream(new ByteArrayInputStream(bytes));
cache = new DataInputStream(cache2);
cache.mark(bytes.length);
DataInputStream midi = new DataInputStream(new FileInputStream(folder + "main_file_cache.idx11"));
int count = 0;
while (midi.available() > 0) {
int length = (midi.readUnsignedByte() << 16) + (midi.readUnsignedByte() << 8) + midi.readUnsignedByte();
int offset = (midi.readUnsignedByte() << 16) + (midi.readUnsignedByte() << 8) + midi.readUnsignedByte();
byte[] b = readFile(length, offset);
if(b == null) continue;
File file = new File(savefolder + "midi" + (++count) + ".mid");
if(!file.exists()) if(!file.createNewFile()) continue;
RandomAccessFile raf = new RandomAccessFile(file, "rw");
raf.write(b);
raf.close();
}
}
public static byte[] getParody(int index) throws Exception {
cache.reset();
byte buffer[] = new byte[520];
int jump = index * 520;
cache.skipBytes(jump);
cache.readFully(buffer);
return buffer;
}
public static byte[] readFile(int size, int offset) throws Exception {
byte b[] = getFile(size, offset);
int length = ((b[5] & 0xff) << 24) + ((b[6] & 0xff) << 16) + ((b[7] & 0xff) << 8) + b[8];
if(length > 0) {
if(b[0] == 2) {
GZIPInputStream d = new GZIPInputStream(new ByteArrayInputStream(b, 9, length));
byte z[] = new byte[b.length];
int i = d.read(z);
byte x[] = new byte[i];
System.arraycopy(z, 0, x, 0, i);
return x;
} else if(b[0] == 1) {
System.out.println("Fu**in' sh**, it's not a midi!!!");
return null;
}
return b;
}
return null;
}
public static byte[] getFile(int size, int offset) throws Exception {
if(offset <= 0) return null;
byte outfile[] = new byte[size];
int bits = offset;
int length = 0;
while(true) {
byte buffer[] = getParody(bits);
if(buffer == null) return null;
bits = ((buffer[4] & 0xff) << 16) + ((buffer[5] & 0xff) << 8) + (buffer[6] & 0xff);
if(size - length - 8 > 512) {
System.arraycopy(buffer, 8, outfile, length, 512);
} else {
System.arraycopy(buffer, 8, outfile, length, size - length - 8);
return outfile;
}
length += 512;
}
}
}[/CODE]

But i dont know how.

Share this post


Link to post
Share on other sites

17 answers to this question

Recommended Posts

  • 0
Run it with an IDE.

Share this post


Link to post
Share on other sites
  • 0
[quote name='Game Master']Run it with an IDE.[/QUOTE]

To be more clear since it seems your new, an IDE is a program used to aid developers. They have things built in that automatically compiles and runs your code, I suggest using eclipse or notepad++

Share this post


Link to post
Share on other sites
  • 0
[quote name='manpaint55']I need to compile or run this code to dump music

[CODE]import java.io.*;
import java.util.zip.GZIPInputStream;
public class MidiDumper {
private static final String folder = "C:\\WINDOWS\\.file_store_32\\runescape\\";
private static final String savefolder = "C:\\save\\";
private static DataInputStream cache;
public static void main(String args[]) throws Exception {
File f = new File(folder + "main_file_cache.dat2");
byte bytes[] = new byte[(int) f.length()];
new FileInputStream(f).read(bytes);
BufferedInputStream cache2 = new BufferedInputStream(new ByteArrayInputStream(bytes));
cache = new DataInputStream(cache2);
cache.mark(bytes.length);
DataInputStream midi = new DataInputStream(new FileInputStream(folder + "main_file_cache.idx11"));
int count = 0;
while (midi.available() > 0) {
int length = (midi.readUnsignedByte() << 16) + (midi.readUnsignedByte() << 8) + midi.readUnsignedByte();
int offset = (midi.readUnsignedByte() << 16) + (midi.readUnsignedByte() << 8) + midi.readUnsignedByte();
byte[] b = readFile(length, offset);
if(b == null) continue;
File file = new File(savefolder + "midi" + (++count) + ".mid");
if(!file.exists()) if(!file.createNewFile()) continue;
RandomAccessFile raf = new RandomAccessFile(file, "rw");
raf.write(b);
raf.close();
}
}
public static byte[] getParody(int index) throws Exception {
cache.reset();
byte buffer[] = new byte[520];
int jump = index * 520;
cache.skipBytes(jump);
cache.readFully(buffer);
return buffer;
}
public static byte[] readFile(int size, int offset) throws Exception {
byte b[] = getFile(size, offset);
int length = ((b[5] & 0xff) << 24) + ((b[6] & 0xff) << 16) + ((b[7] & 0xff) << 8) + b[8];
if(length > 0) {
if(b[0] == 2) {
GZIPInputStream d = new GZIPInputStream(new ByteArrayInputStream(b, 9, length));
byte z[] = new byte[b.length];
int i = d.read(z);
byte x[] = new byte[i];
System.arraycopy(z, 0, x, 0, i);
return x;
} else if(b[0] == 1) {
System.out.println("Fu**in' sh**, it's not a midi!!!");
return null;
}
return b;
}
return null;
}
public static byte[] getFile(int size, int offset) throws Exception {
if(offset <= 0) return null;
byte outfile[] = new byte[size];
int bits = offset;
int length = 0;
while(true) {
byte buffer[] = getParody(bits);
if(buffer == null) return null;
bits = ((buffer[4] & 0xff) << 16) + ((buffer[5] & 0xff) << 8) + (buffer[6] & 0xff);
if(size - length - 8 > 512) {
System.arraycopy(buffer, 8, outfile, length, 512);
} else {
System.arraycopy(buffer, 8, outfile, length, size - length - 8);
return outfile;
}
length += 512;
}
}
}[/CODE]

But i dont know how.[/QUOTE]

Here you go...
[URL="http://www.mediafire.com/download/8o93zurlvd93uh4/Music+Dumper+BAT+and+Jfile.rar"]Music Dumper BAT and Jfile ~ Baki[/URL]
Just change the directory inside the bat to wherever you place the java file at.

Share this post


Link to post
Share on other sites
  • 0
[quote name='StevenAbraham']To be more clear since it seems your new, an IDE is a program used to aid developers. They have things built in that automatically compiles and runs your code, I suggest using eclipse or notepad++[/QUOTE]
Was that directed at me or OP? Also, notepad++ is a syntax highlighter, really. It's not an integrated development environment.

Share this post


Link to post
Share on other sites
  • 0
[quote name='Game Master']Was that directed at me or OP? Also, notepad++ is a syntax highlighter, really. It's not an integrated development environment.[/QUOTE]

it was for op

Share this post


Link to post
Share on other sites
  • 0
[quote name='Chronicscape']Here you go...
[URL="http://www.mediafire.com/download/8o93zurlvd93uh4/Music+Dumper+BAT+and+Jfile.rar"]Music Dumper BAT and Jfile ~ Baki[/URL]
Just change the directory inside the bat to wherever you place the java file at.[/QUOTE]

thank!

Share this post


Link to post
Share on other sites
  • 0
[quote name='Chronicscape']Here you go...
[URL="http://www.mediafire.com/download/8o93zurlvd93uh4/Music+Dumper+BAT+and+Jfile.rar"]Music Dumper BAT and Jfile ~ Baki[/URL]
Just change the directory inside the bat to wherever you place the java file at.[/QUOTE]

I have a error it says :

Unable to load com.rs.tool.Midi.Dumper

Where i find this class???

Share this post


Link to post
Share on other sites
  • 0
change "com.rs.tool.MidiDumper" to ur location [MENTION=258406]manpaint55[/MENTION]

Share this post


Link to post
Share on other sites
  • 0
[quote name='Chronicscape']change "com.rs.tool.MidiDumper" to ur location [MENTION=258406]manpaint55[/MENTION][/QUOTE]

I dont have this class.

Share this post


Link to post
Share on other sites
  • 0
[quote name='manpaint55']I dont have this class.[/QUOTE]

I sent it to u man in the package.... If you dont know how to place it in a folder and change the directory inside the bat then you shouldnt be doing this.

Share this post


Link to post
Share on other sites

×