private static void readExif(RandomAccessFile raf, int offset) throws IOException{
raf.seek(12+offset);
short entries = raf.readShort();
System.out.println(String.format("IFD entries = %d", entries));
for(short i=0; i<entries; i++){
short tag = raf.readShort();
short type = raf.readShort();
int count = raf.readInt();
int offsetOrValue = raf.readInt();
System.out.println(String.format("tag = %x type = %x count = %d offsetOrvalue = %d", tag, type, count, offsetOrValue));
long currPointer = raf.getFilePointer();
if(tag==-30871){
raf.seek(12+offsetOrValue);
short entries2 = raf.readShort();
for(short j=0; j<entries2; j++){
short tag2 = raf.readShort();
short type2 = raf.readShort();
int count2 = raf.readInt();
int offsetOrValue2 = raf.readInt();
System.out.println(String.format("tag = %x type = %d count = %d offsetOrvalue = %d", tag2, type2, count2, offsetOrValue2));
long currPointer2 = raf.getFilePointer();
if(tag2==-28669){
raf.seek(12+offsetOrValue2);
byte[] bb = new byte[count2];
raf.read(bb);
System.out.println("DateTimeOriginal = "+new String(bb));
raf.seek(currPointer2);
}
}
raf.seek(currPointer);
}
}
int nextOffset = raf.readInt();
if(nextOffset>0)
readExif(raf, nextOffset);
}
public static void main(String args[]) {
try {
RandomAccessFile raf = new RandomAccessFile(new File("D:\\Archive\\MyPhotosAndVideos\\IMG_20140920_130624.jpg"), "r");
raf.seek(12);
raf.readShort();
raf.readShort();
readExif(raf, raf.readInt());
raf.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public Document getDocument(String url) throws MalformedURLException,
IOException, Exception {
URL documentUrl = new URL(url);
URLConnection conn = documentUrl.openConnection();
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document;
InputStream stream = null;
try {
stream = conn.getInputStream();
document = builder.parse(stream);
} finally {
if (stream != null)
stream.close();
}
return document;
}
byte[] bb;
...
String test =Base64.encodeBytes(bb);
String html = "<img src=\"data:image/jpeg;base64,"+test+"\" />";
Log.i("MyLog", "firstParam=" +((VremActivity )this.getParent()).getFirstParam());
Intent myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + number));
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(myIntent, 1);
Intent myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + number));
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(myIntent, 1);
org.jsoup
Interface Connection
To get a new Connection, use Jsoup.connect(String).
header(String name, String value)
Set a request header.
data(String key, String value)
Add a request data parameter.
method(Connection.Method method)
Set the request method to use, GET or POST.
try {
Connection conn = Jsoup
.connect("http://4pda.ru/forum/index.php?act=Login&CODE=01");
conn.data("PassWord", "password");
conn.data("UserName", "username");
conn.method(Connection.Method.POST);
conn.referrer("http%3A%2F%2F4pda.ru%2Fforum%2Findex.php%3F");
Response resp = conn.execute();
System.out.println("statusCode: " + resp.statusCode());
Document doc = conn.url("http://4pda.ru/forum/index.php?").get();
System.out.println(doc.select("div.user_home").text());
} catch (IOException e) {
e.printStackTrace();
}
...
Process logcatProc = Runtime.getRuntime().exec("adb logcat -v time -b radio GSM:D *:S");
BufferedReader mReader = new BufferedReader(new InputStreamReader(logcatProc.getInputStream()), 1024);
...
[GSMConn] onConnectedInOrOut: connectTime=1364194745375
[GSMConn] onDisconnected: cause=LOCAL