For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!
Is it possible to use Interactive Grid and call a procedure after every row update? Kind of work similar to AFTER ROW UPDATE trigger but from within an Apex
if(fileContent<0 && fileContent[i]!=10 && fileContent[i]!=13 && fileContent[i]>300) What single value will satisfy the first and third conditions? Edited by: johndjr on Oct 23, 2009 8:26 AM
What single value will satisfy the first and third conditions? Edited by: johndjr on Oct 23, 2009 8:26 AM
if( (fileContent<0 && fileContent[i]!=10 && fileContent[i]!=13) || fileContent[i]>300) // if invalid {System.out.println("failure at position: "+i);break;}< 0 - As I tested, some chars generated -ve values for some codes. 300 - was a try to find out if any characters exceeds actual chars. range.10 and 13 are for line-feed. any alternative (better code ofcourse) way to catch this black sheep ?
< 0 - As I tested, some chars generated -ve values for some codes. 300 - was a try to find out if any characters exceeds actual chars. range.10 and 13 are for line-feed. any alternative (better code ofcourse) way to catch this black sheep ?
if( (fileContent<0 && fileContent[i]!=10 && fileContent[i]!=13) || fileContent[i]>300) // if invalid {System.out.println("failure at position: "+i);break;}lessthan 0 - I saw some -ve values when I was testing with other files. greaterthan 300 - was a try to find out if any characters exceeds actual chars. range. if 10 and 13 are for line-feed. with this, I randomly placed chinese, korean characters and program found them. any alternative (better code ofcourse) way to catch this black sheep ? Edited by: Sanath_K on Oct 23, 2009 8:06 PM
lessthan 0 - I saw some -ve values when I was testing with other files. greaterthan 300 - was a try to find out if any characters exceeds actual chars. range. if 10 and 13 are for line-feed. with this, I randomly placed chinese, korean characters and program found them. any alternative (better code ofcourse) way to catch this black sheep ? Edited by: Sanath_K on Oct 23, 2009 8:06 PM
if( (fileContent<0 && fileContent[i]!=10 && fileContent[i]!=13) || fileContent[i]>300) // if invalid {System.out.println("failure at position: "+i);break;}lessthan 0 - I saw some -ve values when I was testing with other files. greaterthan 300 - was a try to find out if any characters exceeds actual chars. range. if 10 and 13 are for line-feed. with this, I randomly placed chinese, korean characters and program found them. any alternative (better code ofcourse) way to catch this black sheep ?A less obfuscated way of doing that would be if( (fileContent&0x80)!=0 ) // if not ASCII-7 {System.out.println("failure at position: "+i);break;}
lessthan 0 - I saw some -ve values when I was testing with other files. greaterthan 300 - was a try to find out if any characters exceeds actual chars. range. if 10 and 13 are for line-feed. with this, I randomly placed chinese, korean characters and program found them. any alternative (better code ofcourse) way to catch this black sheep ?
if( (fileContent&0x80)!=0 ) // if not ASCII-7 {System.out.println("failure at position: "+i);break;}
fin.read(fileContent);
FileInputStream fin; ByteArrayOutputStream baos = new ByteArrayOutputStream(); int len; byte[] buf = new byte[1024]; while ( (len = fin.read(buf)) != -1 ) { baos.write(buf, 0, len); } byte[] fileContents = baos.toByteArray();
BufferedInputStream bin = new BufferedInputStream(fin); for (int b = -1; (b = bin.read()) != -1; ) { //deal with this byte }
Reader r = new InputStreamReader(new FileReader(file), "UTF-8"); int character = 0; while ((character = r.read()) >= 0) { // here we have a stream of characters decoded using UTF-8 if (character > 127) { // this one isn't ASCII } }
package forums; import java.io.FileInputStream; import java.io.BufferedInputStream; // ÊPIC FÃIL! public class ExtendedCharacterDetector { public static void main(String[] args) { String filename = args.length>0 ? args[0] : "ExtendedCharacterDetector.java"; try { BufferedInputStream input = null; try { input = new BufferedInputStream(new FileInputStream(filename)); int count = 0; for ( int i=0,b=-1; (b=input.read()) != -1; ++i ) { if ( (b&0x80) != 0 ) { System.out.println("byte "+i+" is "+b); count++; } } System.out.println("Number of bytes exceeding "+0x80+" = "+count); } finally { if(input!=null)input.close(); } } catch (Exception e) { e.printStackTrace(); } } }
byte 94 is 195 byte 95 is 138 byte 101 is 195 byte 102 is 131 Number of bytes exceeding 128 = 4