FormatCode Code Formatter is based on serveral powerful syntax parser engines
so you can exactly control the appearance of your source code. Here is the code formatting demo of
FormatCode Java Code Formatter to prove the ability of code formatting
functions of FormatCode:
import java.io.*;import java.net.*;public class BlockingServer{public static
void main(String args[]){try{System.err.println("Blocking server starting...");
ServerSocket s=new ServerSocket(4046);Socket clisock=s.accept();
System.err.println("Got connection from "+clisock.getInetAddress().getHostName(
));InputStream is=clisock.getInputStream();byte barr[]=new byte[1024];
/** while loop statement. */while(true){int c=is.read(barr,0,1024
);if(c==-1){System.err.println("READ ERROR");}else if(c==0){System.err.println(
"READ NOTHING");}else{String str=new String(barr,0,c);System.err.println(
"READ: "+str);}}}catch(Exception e){System.err.println(
"BlockingServer: Caught exception: "+e);e.printStackTrace();System.exit(-1);}}}
import java.io.*;
import java.net.*;
public class BlockingServer
{
public static void main(String args[])
{
try
{
System.err.println("Blocking server starting...");
ServerSocket s = new ServerSocket(4046);
Socket clisock = s.accept();
System.err.println("Got connection from " + clisock.getInetAddress()
.getHostName());
InputStream is = clisock.getInputStream();
byte barr[] = new byte[1024];
/** while loop statement. */
while (true)
{
int c = is.read(barr, 0, 1024);
if (c == - 1)
{
System.err.println("READ ERROR");
}
else if (c == 0)
{
System.err.println("READ NOTHING");
}
else
{
String str = new String(barr, 0, c);
System.err.println("READ: " + str);
}
}
}
catch (Exception e)
{
System.err.println("BlockingServer: Caught exception: " + e);
e.printStackTrace();
System.exit( - 1);
}
}
}
Click here to preview the Java Code Formatting Demo 1.
With FormatCode Java Code Formatters, you can format and transform any foreign Java source code to meet your preferred coding style or any common code convention in several seconds!
|