public byte[] getFile(String location){ FileConnection fc = null; ByteArrayOutputStream bStrm = null; InputStream is; try{ fc = (FileConnection)Connector.open(location, Connector.READ); //Check if it is more than 150kb, if so throw an exception if((int)fc.fileSize() > 64000){ showInfo( "files too big " ); } is = fc.openInputStream(); int ch; bStrm = new ByteArrayOutputStream(); while ((ch = is.read()) != -1){ bStrm.write(ch); } return bStrm.toByteArray(); }catch(Exception e){ showInfo( "get files error " ); return null; }finally{ if(fc != null){try{fc.close();}catch(Exception ee){}} if(bStrm != null){try{bStrm.close();}catch(Exception ee){}} } }