Search results

  1. marshian

    archive file in image

    *sigh* You do know what break means, right? :p int a = 0; while(a < jFileChooser1.getSelectedFiles().length) { File input = jFileChooser1.getSelectedFiles()[a]; InputStream inFile = null; //Initialise the value of 'valid' to false String valid = "false"; //This is the signature...
  2. marshian

    Java to exe?

    Have you read that article? It's very interesting :p
  3. marshian

    URL Question

    You could do that with some basic php. It's easier if you'd want http://mysite.com/index.php?page=home or something like that (notice the 'page=' instead of '='). If it was the link I posted you could have a code like this: <?php if($_GET["page"] == "home") { include "home.php"; exit; } ?>...
  4. marshian

    archive file in image

    It's not my fault, I was trying to set up some stuff and wanted to post that message in the least amount of time possible while still half focussing on the process... At least you got the point, that's good enough ;)
  5. marshian

    archive file in image

    Beware, non-tested code ahead! File input = new File(output); InputStream inFile = null; //Initialise the value of 'valid' to false boolean valid = false; //This is the signature every file should have byte[] signature = {0x58, 0x59, 0x12, 0xA2}; try { inFile = new FileInputStream(input)...
  6. marshian

    archive file in image

    No it's just pseudo-code used to explain the algorithm. In this case it's easier to write pseudo-code than to explain it all in text :)
  7. marshian

    archive file in image

    I said it's me-code :p '\u58' + '\u59' + '\u12' + '\uA2' should be ((char) 0x58) + ((char) 0x59) + ((char) 0x12) + ((char) 0xA2) in Java
  8. marshian

    archive file in image

    Aha... You noticed how the output file is 11 bytes in size? I forgot to append x) outOSS = new ObjectOutputStream((OutputStream) new FileOutputStream(output, true)); That should prevent the OOS from overwriting the entire file.
  9. marshian

    archive file in image

    Yes please. What kind of image did you use to test? I manually tried it on a png file and the generated image was valid enough to show up in Gnome's image viewer and firefox.
  10. marshian

    archive file in image

    It's probably a bad idea to use two OutputStreams to the same file at the same file. You should finish with the FileOutputStream before making the OOS. Apart from that it looks good to me. Does this really destroy the image? Adding any other data doesn't destroy it so why would this do? Have...
  11. marshian

    archive file in image

    Good attempt, but not entirely correct. Your only mistake (as far as I see) are these lines: out.write('\n'); out.write((int) imageFile.length()); This is wrong because: you don't know the size of that integer. If the image is 10,000 bytes, it'll be represented by a 6 character string, but...
  12. marshian

    archive file in image

    Good luck on that, in case you need more info just let me know.
  13. marshian

    archive file in image

    That's going to be a hefty piece of memory required to get a copy action done... How about you read the image byte by byte and immediately write it out to the output file? Repeat the same for the archive. Then write with an ObjectOutputStream an integer containing the size of the image file to...
  14. marshian

    archive file in image

    Reading back in very basic me-code: File input = new File("input.jpg"); if(input.lastFourBytes() == '\u58' + '\u59' + '\u12' + '\uA2') { //valid input int imagesize = input.readInt(input.size()-8 till input.size()-4); byte[] archive = input.read(imagesize till input.size()-8); } else {...
  15. marshian

    archive file in image

    If you use pure Java it'll work on any OS with Java :p It's not hard, if you want I'll write example code. Edit: I tried adding some random data to a gif, png and jpeg image and in all 3 cases the images were still valid. It's not a guarantee, but it might indicate your method of just appending...
  16. marshian

    archive file in image

    Your method is basically the same, if your method works then adding another 8 byte shouldn't destroy the image. Your method just copies the archive behind the image, doesn't it?
  17. marshian

    archive file in image

    I don't like your code :p The problem is you don't know where the image ends and the archive starts. You could search for the signature of a zip/rar archive in the image file, but who says those can't occur in the body of an image? Therefore you can't be sure it's actually going to work. If I...
  18. marshian

    Expand footer to bottom of page, if nessesary

    I don't know of any easy way to do this, but I don't like giving up... ;) Do you know how to work with negative margins? I'd try to give your main content element a height of 100% and using a negative top and bottom margin to make place for header and footer. If that works you still *might*...
  19. marshian

    Java to exe?

    Have a linky: http://www.excelsior-usa.com/articles/java-to-exe.html
  20. marshian

    archive file in image

    I think it would be of a lot of use if you mentioned how you stored that archive in that image :p If you want to reverse it you'll probably be basing yourself on the original encryption code too... (I'll subscribe to this topic so it won't take over a week to get response this time (a))
Top