java log add function
#dd_traces.pl (C) Marko Kivij?rvi 2006
# Dummy checks
die "Specify an input file!\n" if $ARGV[0] eq "";
die "File not found!\n" unless -e $ARGV[0];
die "Incorrect file extension for a C/C++ file!\n"
if ( $ARGV[0] !~ /(.*)\.(java)$/ );
# Constants
my $IMPORT_LOG_PACKAG = "\nimport android.util.Log;";
my $TAG;
if( $ARGV[0] !~ /BaseAdapter\.java/ && $ARGV[0] !~ /View\.java/) {
$TAG="SWIFTTAG";
}
else {
$TAG="SWIFTBASETAG";
}
# Parse output filename from the input filename
my $file = $ARGV[0];
my $origFile = $1."-orig.".$2;
#system( "cp $file $origFile" );
# Reset the input record separator (newline) so the entire file is read at once
undef $/;
# Read the input file
$_ = <>; # All there
# Adds a tracer macro after each function definition
s/
package #package
\s+
[^{;\/(\s]*\.[^{;\/(\s]* # package name
;
/
AddLogImport(tiny_mce_markeramp;) # Print the match and add the macro
/gxe; # g = repeat, x = split regex to multiple lines, e = evaluate substitution
s/
(public|private|protected)? #api property type
(\s+)?
(abstract)?
(\s+)?
class # Possible function return type
\s+ # One or more empty spaces
(\b\w+?) &n
Ïà¹ØÎĵµ£º
String str = "ÖÐ";
String str1 = new String(str.getBytes("gbk"), "ISO8859-1");
String str2 = new String(str1.getBytes("ISO8859-1"), "gbk");
System.out.println(str2); //Êä³ö"ÖÐ" ......
¿ÉÄÜÓкܶàѧϰJavaµÄÅóÓÑ»¹²»ÖªµÀJavaµÄÔËÐÐÔÀí¡¢JavaÐéÄâ»úÊÇÔõô¹¤×÷µÄ£¬±¾ÎĽ«ÎªÄãÏêϸ½²½â(JVM)Java ÐéÄâ»ú¡£
¡¡¡¡ÔÚJavaÖÐÒýÈëÁËÐéÄâ»úµÄ¸ÅÄ¼´ÔÚ»úÆ÷ºÍ±àÒë³ÌÐòÖ®¼ä¼ÓÈëÁËÒ»²ã³éÏóµÄÐéÄâµÄ»úÆ÷¡£Õą̂ÐéÄâµÄ»úÆ÷ÔÚÈÎºÎÆ½Ì¨É϶¼Ìṩ¸ø±àÒë³ÌÐòÒ»¸öµÄ¹²Í¬µÄ½Ó¿Ú¡£±àÒë³ ......
import java.io.*;
public class FileReaderSample {
public static void main(String args[]) throws IOException
{
// ½¨Á¢¿ÉÈÝÄÉ1024¸ö×Ö·ûµÄÊý×é
char data[]=new char[1024];
// ½¨Á¢¶ÔÏófr
FileReader fr= ......
import java.io.*;
public class FileWrite {
public static void main(String args[]) {
String outPut = "C:\\bin";
StringBuffer ab = new StringBuffer();
for(int i=6;i<=30;i++){
ab.append("http://www.test.com/joke/index_"+i+".htm\r\n&qu ......
×î½üÔÚѧϰjavaµÄʱºò£¬¶ÔÓÚjavaº¯ÊýµÄ´«µÝÁ˽âÁËһϡ£javaµÄÊý¾ÝÀàÐÍ´óµÄ·ÖΪÁ½ÖÖ£¬Ò»ÖÖÊÇ»ù±¾Êý¾ÝÀàÐÍ£¬ÁíÒ»ÖÖÊÇ·Ç»ù±¾Êý¾ÝÀàÐÍ£¬£¨ÀàÊý¾ÝÀàÐÍ£©¡£ÔÚ²ÎÊý´«µÝʱºò£¬»ù±¾µÄÊý¾ÝÀàÐÍ´«µÝµÄÊǶÔʵ²ÎÊýµÄÒ»·Ý¿½±´£¬¶ø·Ç»ù±¾Êý¾ÝÀàÐÍÔòÊÇʵÀýµÄÒýÓõÄÒ»·Ý¿½±´¡£ÎÒµÄÀí½âÊÇÀàµÄʵÀý£¬¼´¶ÔÏ󴿷ŵÄÄÚÈݾÍÊÇÒýÓã¬Êµ¼ÊÊǵØÖ·¡£
......