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
[quote name='Chronicscape']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.[/QUOTE]

if is the mididumper.java a you talking yes i have but is still say this class is missing.

Share this post


Link to post
Share on other sites
  • 0
He's trying to explain that the packaging is incorrect. You have to alter the first line of your code, the packaging, to align it to the package the class is in.

Share this post


Link to post
Share on other sites
  • 0
[quote name='Game Master']He's trying to explain that the packaging is incorrect. You have to alter the first line of your code, the packaging, to align it to the package the class is in.[/QUOTE]

Yea with directions im not really forward with them lol. Thanks for explaining to this person.

Share this post


Link to post
Share on other sites
  • 0
... [url]http://tutorials.jenkov.com/java/packages.html[/url]

Don't stop reading when the subject is done. Read all of his tutorials.

Share this post


Link to post
Share on other sites
  • 0
[quote name='Arix']... [url]http://tutorials.jenkov.com/java/packages.html[/url]

Don't stop reading when the subject is done. Read all of his tutorials.[/QUOTE]
Or perhaps Oracle's documentations: [url]https://docs.oracle.com/javase/tutorial/reallybigindex.html[/url]

Share this post


Link to post
Share on other sites
  • 0
[quote name='Game Master']Or perhaps Oracle's documentations: [url]https://docs.oracle.com/javase/tutorial/reallybigindex.html[/url][/QUOTE]Jenkov's tutorials are more to the point and need-to-know for everyday usage.

Share this post


Link to post
Share on other sites
  • 0
Perhaps, though the Really Big Index has a more in-depth look at a far wider variety of guides; from, dare I say, the most credible source.

Share this post


Link to post
Share on other sites

×