Re: java interop help for beginner calling java class
So close!! i have a question about the called java class and access to the byte array from clojure upon return of the call to java the call to the method in the class has 2 args buffer in and buffer out. i confirmed that the data is in buf and nnnx contains the correct size of the uncompressed file. i do not see the uncompressed data in bufout. (import '(mynicelzw1 OcfLZWBW)) def fbw (new OcfLZWBW) buf (byte-array 1) ; input buffer n (.read in buf) ; file read in to decompress bufout (byte-array 20) ; output buffer nnnx(.expand fbw buf bufout) When I debug the repl i see the the file read in to buf the call made to .expand in the class OcfLZWBW I get the correct number of the size of the uncompressed data (nnnx) I do not see the uncompressed data in bufout, in the debug bufout is null. as always any help would be appreciated. Thanks On Friday, March 28, 2014 10:12:08 AM UTC-5, bww00...@yahoo.com wrote: > > I have read so much i cant see the tree for the forest. > and need some help calling the ocfLZW class below from clojure. > > THANKS for the help > > using eclipse and counterclockwise > > In clojure > have the data to decompress read into an array. > have an array allocated to hold the decompresed data > > > The java class ocfLZW is accessible > > I have a java program exert below that calls the ocfLZW class and verified > that it works. > > > FileInputStream fis = new FileInputStream(input); > > byte[] sInefficient= new byte[(int)input.length()] ; > fis.read(sInefficient); > > OcfLZW oi = new OcfLZW(); > > byte[] out = null; > > out = new byte[160]; > > int len = oi.expand(sInefficient, out); > System.out.println(new String (out)); > System.out.println("out size = "+len); > > > ocfLZW java class that does LZW decompress > > /* */ public class OcfLZW > /* */ { > /* */ static final int INIT_BITS = 9; > /* 6 */ final int MAX_BITS = 13; > /* 7 */ final int TABLE_SIZE = 9029; > /* 8 */ final int HASH_SHIFT = 5; > /* 9 */ final int CLEAR_TABLE = 256; > /* 10 */ final int TERMINATOR = 257; > /* */ static final int FIRST_CODE = 258; > /* */ static final int CHECK_TIME = 100; > /* 13 */ final int STACK_SIZE = 4000; > /* 14 */ boolean EOF = false; > /* */ static int myIndex; > /* */ static int offset; > /* */ static int input_bit_buffer; > /* */ static int output_bit_buffer; > /* */ static int string_code; > /* */ static int bytes_out_this_time; > /* 22 */ static int next_code = 258; > /* */ static int max_code; > /* 24 */ static int checkpoint = 100; > /* 25 */ static int tot_bytesin = 0; > /* */ static int gbl_ulong; > /* 28 */ static int[] code_value = null; > /* 29 */ static int[] prefix_code = null; > /* 31 */ int input_bit_count = 0; > /* 32 */ int output_bit_count = 0; > /* 33 */ int num_bits = 9; > /* 34 */ int clear_bytesin = 0; > /* 35 */ int clear_bytesout = 0; > /* 36 */ int tot_bytesout = 0; > /* */ int ratio_new; > /* 38 */ int ratio_old = 100; > /* 40 */ static boolean compress_flag = false; > /* 41 */ static int initialized = 0; > /* 43 */ static byte[] in_buffpoint = null; > /* 44 */ static byte[] out_buffpoint = null; > /* 45 */ int in_buff_n = 0; > /* 45 */ int out_buff_n = 0; > /* 45 */ int in_buffend = 0; > /* 45 */ int out_buffend = 0; > /* 47 */ byte[] append_character = null; > /* 48 */ byte gbl_ptr_idx = 0; > /* 50 */ byte[] decode_stack = null; > /* 51 */ int ds_i = 0; > /* */ > /* */ public int expand(byte[] paramArrayOfByte1, byte[] > paramArrayOfByte2) > /* */ { > /* 56 */ this.ds_i = 0; > /* */ > /* 58 */ compress_flag = false; > /* */ > /* */ > /* 61 */ max_code = (1 << this.num_bits) - 1; > /* 62 */ prefix_code = new int[9029]; > /* 63 */ this.append_character = new byte[9029]; > /* */ > /* */ > /* */ > /* 67 */ this.decode_stack = new byte[4000]; > /* 69 */ if ((prefix_code == null) || (this.append_character == null) > || (this.decode_stack == null) || ((compress_flag) && (code_value == > null))) { > /* 73 */ return 0; > /* */ } > /* 75 */ out_buffpoint = paramArrayOfByte2; > /* 76 */ this.out_buff_n = 0; > /* 77 */ in_buffpoint = paramArrayOfByte1; > /* 78 */ this.in_buff_n = 0; > /* */ > /* */ > /* */ > /* 82 */ int[] arrayOfInt1 = new int[1]; > /* 83 */ int i = 0; > /* 84 */ int j = 0; > /* */ > /* 86 */ int[] arrayOfInt2 = new int[1]; > /* 87 */ int m = 0; > /* 88 */ arrayOfInt1[0] = 0; > /* */ > /* 90 */ arrayOfInt2[0] = 0; > /* */ > /* 92 */ int k = 1; > /* */ > /* */ > /* */ > /* */ > /* */ > /*
Re: java interop help for beginner calling java class
ANother step further Thanks for the help.. I set up the diretory struc and can import the class. Now to get the call working. On Friday, March 28, 2014 10:12:08 AM UTC-5, bww00...@yahoo.com wrote: > > I have read so much i cant see the tree for the forest. > and need some help calling the ocfLZW class below from clojure. > > THANKS for the help > > using eclipse and counterclockwise > > In clojure > have the data to decompress read into an array. > have an array allocated to hold the decompresed data > > > The java class ocfLZW is accessible > > I have a java program exert below that calls the ocfLZW class and verified > that it works. > > > FileInputStream fis = new FileInputStream(input); > > byte[] sInefficient= new byte[(int)input.length()] ; > fis.read(sInefficient); > > OcfLZW oi = new OcfLZW(); > > byte[] out = null; > > out = new byte[160]; > > int len = oi.expand(sInefficient, out); > System.out.println(new String (out)); > System.out.println("out size = "+len); > > > ocfLZW java class that does LZW decompress > > /* */ public class OcfLZW > /* */ { > /* */ static final int INIT_BITS = 9; > /* 6 */ final int MAX_BITS = 13; > /* 7 */ final int TABLE_SIZE = 9029; > /* 8 */ final int HASH_SHIFT = 5; > /* 9 */ final int CLEAR_TABLE = 256; > /* 10 */ final int TERMINATOR = 257; > /* */ static final int FIRST_CODE = 258; > /* */ static final int CHECK_TIME = 100; > /* 13 */ final int STACK_SIZE = 4000; > /* 14 */ boolean EOF = false; > /* */ static int myIndex; > /* */ static int offset; > /* */ static int input_bit_buffer; > /* */ static int output_bit_buffer; > /* */ static int string_code; > /* */ static int bytes_out_this_time; > /* 22 */ static int next_code = 258; > /* */ static int max_code; > /* 24 */ static int checkpoint = 100; > /* 25 */ static int tot_bytesin = 0; > /* */ static int gbl_ulong; > /* 28 */ static int[] code_value = null; > /* 29 */ static int[] prefix_code = null; > /* 31 */ int input_bit_count = 0; > /* 32 */ int output_bit_count = 0; > /* 33 */ int num_bits = 9; > /* 34 */ int clear_bytesin = 0; > /* 35 */ int clear_bytesout = 0; > /* 36 */ int tot_bytesout = 0; > /* */ int ratio_new; > /* 38 */ int ratio_old = 100; > /* 40 */ static boolean compress_flag = false; > /* 41 */ static int initialized = 0; > /* 43 */ static byte[] in_buffpoint = null; > /* 44 */ static byte[] out_buffpoint = null; > /* 45 */ int in_buff_n = 0; > /* 45 */ int out_buff_n = 0; > /* 45 */ int in_buffend = 0; > /* 45 */ int out_buffend = 0; > /* 47 */ byte[] append_character = null; > /* 48 */ byte gbl_ptr_idx = 0; > /* 50 */ byte[] decode_stack = null; > /* 51 */ int ds_i = 0; > /* */ > /* */ public int expand(byte[] paramArrayOfByte1, byte[] > paramArrayOfByte2) > /* */ { > /* 56 */ this.ds_i = 0; > /* */ > /* 58 */ compress_flag = false; > /* */ > /* */ > /* 61 */ max_code = (1 << this.num_bits) - 1; > /* 62 */ prefix_code = new int[9029]; > /* 63 */ this.append_character = new byte[9029]; > /* */ > /* */ > /* */ > /* 67 */ this.decode_stack = new byte[4000]; > /* 69 */ if ((prefix_code == null) || (this.append_character == null) > || (this.decode_stack == null) || ((compress_flag) && (code_value == > null))) { > /* 73 */ return 0; > /* */ } > /* 75 */ out_buffpoint = paramArrayOfByte2; > /* 76 */ this.out_buff_n = 0; > /* 77 */ in_buffpoint = paramArrayOfByte1; > /* 78 */ this.in_buff_n = 0; > /* */ > /* */ > /* */ > /* 82 */ int[] arrayOfInt1 = new int[1]; > /* 83 */ int i = 0; > /* 84 */ int j = 0; > /* */ > /* 86 */ int[] arrayOfInt2 = new int[1]; > /* 87 */ int m = 0; > /* 88 */ arrayOfInt1[0] = 0; > /* */ > /* 90 */ arrayOfInt2[0] = 0; > /* */ > /* 92 */ int k = 1; > /* */ > /* */ > /* */ > /* */ > /* */ > /* 98 */ inputCode(arrayOfInt1); > /* 99 */ while ((!this.EOF) && (arrayOfInt1[0] != 257)) > /* */ { > /* 100 */ if (k > 0) > /* */ { > /* 101 */ i = arrayOfInt1[0]; > /* 102 */ j = i; > /* 104 */ if (arrayOfInt1[0] <= 255) > /* */ { > /* 105 */ k = 0; > /* 106 */ if (putByte(i) == 0) { > /* 107 */ return 0; > /* */ } > /* 108 */ m++; > /* 109 */ inputCode(arrayOfInt1); > /* 110 */ continue; > /* */ } > /* */ } > /* 114 */ if (arrayOfInt1[0] == 256) > /* */ { > /* 115 */ k = 1; > /* 116 */ this.num_bits = 9; > /* 117 */ next_code = 258;
Re: java interop help for beginner calling java class
Thanks I did not set the hierarchy I will give that a whirl Regards Bryan On Saturday, March 29, 2014 1:07:40 PM UTC-5, Chris Shellenbarger wrote: > > Did you move it to the corresponding directory structure? So, > com.example.mystuff would need a directory hierarchy like > com/example/mystuff. The mystuff directory is where you need to put your > java files that are in the com.example.mystuff package. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
java interop help for beginner calling java class
I have read so much i cant see the tree for the forest. and need some help calling the ocfLZW class below from clojure. THANKS for the help using eclipse and counterclockwise In clojure have the data to decompress read into an array. have an array allocated to hold the decompresed data The java class ocfLZW is accessible I have a java program exert below that calls the ocfLZW class and verified that it works. FileInputStream fis = new FileInputStream(input); byte[] sInefficient= new byte[(int)input.length()] ; fis.read(sInefficient); OcfLZW oi = new OcfLZW(); byte[] out = null; out = new byte[160]; int len = oi.expand(sInefficient, out); System.out.println(new String (out)); System.out.println("out size = "+len); ocfLZW java class that does LZW decompress /* */ public class OcfLZW /* */ { /* */ static final int INIT_BITS = 9; /* 6 */ final int MAX_BITS = 13; /* 7 */ final int TABLE_SIZE = 9029; /* 8 */ final int HASH_SHIFT = 5; /* 9 */ final int CLEAR_TABLE = 256; /* 10 */ final int TERMINATOR = 257; /* */ static final int FIRST_CODE = 258; /* */ static final int CHECK_TIME = 100; /* 13 */ final int STACK_SIZE = 4000; /* 14 */ boolean EOF = false; /* */ static int myIndex; /* */ static int offset; /* */ static int input_bit_buffer; /* */ static int output_bit_buffer; /* */ static int string_code; /* */ static int bytes_out_this_time; /* 22 */ static int next_code = 258; /* */ static int max_code; /* 24 */ static int checkpoint = 100; /* 25 */ static int tot_bytesin = 0; /* */ static int gbl_ulong; /* 28 */ static int[] code_value = null; /* 29 */ static int[] prefix_code = null; /* 31 */ int input_bit_count = 0; /* 32 */ int output_bit_count = 0; /* 33 */ int num_bits = 9; /* 34 */ int clear_bytesin = 0; /* 35 */ int clear_bytesout = 0; /* 36 */ int tot_bytesout = 0; /* */ int ratio_new; /* 38 */ int ratio_old = 100; /* 40 */ static boolean compress_flag = false; /* 41 */ static int initialized = 0; /* 43 */ static byte[] in_buffpoint = null; /* 44 */ static byte[] out_buffpoint = null; /* 45 */ int in_buff_n = 0; /* 45 */ int out_buff_n = 0; /* 45 */ int in_buffend = 0; /* 45 */ int out_buffend = 0; /* 47 */ byte[] append_character = null; /* 48 */ byte gbl_ptr_idx = 0; /* 50 */ byte[] decode_stack = null; /* 51 */ int ds_i = 0; /* */ /* */ public int expand(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2) /* */ { /* 56 */ this.ds_i = 0; /* */ /* 58 */ compress_flag = false; /* */ /* */ /* 61 */ max_code = (1 << this.num_bits) - 1; /* 62 */ prefix_code = new int[9029]; /* 63 */ this.append_character = new byte[9029]; /* */ /* */ /* */ /* 67 */ this.decode_stack = new byte[4000]; /* 69 */ if ((prefix_code == null) || (this.append_character == null) || (this.decode_stack == null) || ((compress_flag) && (code_value == null))) { /* 73 */ return 0; /* */ } /* 75 */ out_buffpoint = paramArrayOfByte2; /* 76 */ this.out_buff_n = 0; /* 77 */ in_buffpoint = paramArrayOfByte1; /* 78 */ this.in_buff_n = 0; /* */ /* */ /* */ /* 82 */ int[] arrayOfInt1 = new int[1]; /* 83 */ int i = 0; /* 84 */ int j = 0; /* */ /* 86 */ int[] arrayOfInt2 = new int[1]; /* 87 */ int m = 0; /* 88 */ arrayOfInt1[0] = 0; /* */ /* 90 */ arrayOfInt2[0] = 0; /* */ /* 92 */ int k = 1; /* */ /* */ /* */ /* */ /* */ /* 98 */ inputCode(arrayOfInt1); /* 99 */ while ((!this.EOF) && (arrayOfInt1[0] != 257)) /* */ { /* 100 */ if (k > 0) /* */ { /* 101 */ i = arrayOfInt1[0]; /* 102 */ j = i; /* 104 */ if (arrayOfInt1[0] <= 255) /* */ { /* 105 */ k = 0; /* 106 */ if (putByte(i) == 0) { /* 107 */ return 0; /* */ } /* 108 */ m++; /* 109 */ inputCode(arrayOfInt1); /* 110 */ continue; /* */ } /* */ } /* 114 */ if (arrayOfInt1[0] == 256) /* */ { /* 115 */ k = 1; /* 116 */ this.num_bits = 9; /* 117 */ next_code = 258; /* 118 */ max_code = MAXVAL(this.num_bits); /* 119 */ inputCode(arrayOfInt1); /* */ } /* */ else /* */ { /* 127 */ if (arrayOfInt1[0] >= next_code) /* */ { /* 128 */ this.decode_stack[this.ds_i] = ((byte)j); /* 129 */ if (decodeString(arrayOfInt2, this.decode_stack, this.ds_i + 1, i) == 0) { /* 130 */ return 0; /* */ } /* */ } /* 133 */ else if (
Re: looking for a lzw decompress routine written in clojure
yep, i actually have one but i thought it would be easier with all clojure. i am going to go ahead and look at the clojure > java class interop with the lzw java class i have i am on a learn clojure quest Thanks again On Thursday, March 27, 2014 5:09:52 PM UTC-5, bww00...@yahoo.com wrote: > > > > Thanks > Bryan > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
looking for a lzw decompress routine written in clojure
Thanks Bryan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: need help reading blob column from oracle
Niels, Cant thank you enough. Regards Bryan On Sunday, January 26, 2014 10:21:18 PM UTC-6, bww00...@yahoo.com wrote: > > ANyone have some examples reading a blob column from an oracle db. > > We have a database with a blob column. > A entity can be split acroos multiple rows. > If there are multiple rows we need to read anc concatenate the rows into a > single buffer > There may be multiple rows that we need to read to concatnate the blobs in > this row set > > any help would be appreciated > > Thanks > bryan > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: need help reading blob column from oracle
here is where I have gotten: query seems to be getting the blob I am at a loss on how to get to the blob to say write it to a file, or ultimately construct a blob of multiple blobs AS usual any help is greatly appreciated (jdbc/query db["select blob_contents from ce_blob where event_id =?" 10024279] :row-fn(fn[r](some-> r :blob_contents .getBinaryStream io/reader (print r ..returns # # {:blob_contents #} (nil) On Sunday, January 26, 2014 10:21:18 PM UTC-6, bww00...@yahoo.com wrote: > > ANyone have some examples reading a blob column from an oracle db. > > We have a database with a blob column. > A entity can be split acroos multiple rows. > If there are multiple rows we need to read anc concatenate the rows into a > single buffer > There may be multiple rows that we need to read to concatnate the blobs in > this row set > > any help would be appreciated > > Thanks > bryan > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: need help reading blob column from oracle
Well even a blind hog finds an acorn once and a while. I am getting the blob, but need to do some additional processing on it, say write to a file. please help the hog find another acorn Thanks so much for the help BRyan On Sunday, January 26, 2014 10:21:18 PM UTC-6, bww00...@yahoo.com wrote: > > ANyone have some examples reading a blob column from an oracle db. > > We have a database with a blob column. > A entity can be split acroos multiple rows. > If there are multiple rows we need to read anc concatenate the rows into a > single buffer > There may be multiple rows that we need to read to concatnate the blobs in > this row set > > any help would be appreciated > > Thanks > bryan > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: need help reading blob column from oracle
I am getting a "unable to resolve symbol : some-> r in this context On Sunday, January 26, 2014 10:21:18 PM UTC-6, bww00...@yahoo.com wrote: > > ANyone have some examples reading a blob column from an oracle db. > > We have a database with a blob column. > A entity can be split acroos multiple rows. > If there are multiple rows we need to read anc concatenate the rows into a > single buffer > There may be multiple rows that we need to read to concatnate the blobs in > this row set > > any help would be appreciated > > Thanks > bryan > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: need help reading blob column from oracle
Niels Thanks I am new to clojure could you point me in a direction for : making it a reader i assume that the row-fn is getting earch row and each is being processed by the fn[r] is the fieldidentifier the field that the blob_contents column is being put into ? Thanks and i apologize Bryan On Sunday, January 26, 2014 10:21:18 PM UTC-6, bww00...@yahoo.com wrote: > > ANyone have some examples reading a blob column from an oracle db. > > We have a database with a blob column. > A entity can be split acroos multiple rows. > If there are multiple rows we need to read anc concatenate the rows into a > single buffer > There may be multiple rows that we need to read to concatnate the blobs in > this row set > > any help would be appreciated > > Thanks > bryan > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
need help reading blob column from oracle
ANyone have some examples reading a blob column from an oracle db. We have a database with a blob column. A entity can be split acroos multiple rows. If there are multiple rows we need to read anc concatenate the rows into a single buffer There may be multiple rows that we need to read to concatnate the blobs in this row set any help would be appreciated Thanks bryan -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.