|
Java Source Code Formatting Show |
|
| |
|
|
SourceFormatX code formatter bases on powerful syntax parse engines so it can beautify and format source code files with omnifarious styles, even these messy source code examples below:
|
Java Source Code Formatting Examples:
Example 1
|
Example 2
|
Example 3
|
Example 4
The purpose of this java code formatting demonstration is to show the power of Java language syntax parse engine which powered by SourceFormatX Java Code Formatter.
import ninja2.core.io_core.nbio.*;import java.io.*;import java.net.*;public
class NBIOServer{public static void main(String args[]){try{System.err.println(
"NBIO server starting...");NonblockingServerSocket s=new
NonblockingServerSocket(4046);NonblockingSocket clisock=s.accept();
System.err.println("Got connection from "+clisock.getInetAddress().getHostName(
));InputStream is=clisock.getInputStream();byte barr[]=new byte[1024];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("NBIOServer: Caught exception: "+e);e.printStackTrace();
System.exit(-1);}}}
import ninja2.core.io_core.nbio.*;
import java.io.*;
import java.net.*;
public class NBIOServer
{
public static void main(String args[])
{
try
{
System.err.println("NBIO server starting...");
NonblockingServerSocket s = new NonblockingServerSocket(4046);
NonblockingSocket clisock = s.accept();
System.err.println("Got connection from " + clisock.getInetAddress()
.getHostName());
InputStream is = clisock.getInputStream();
byte barr[] = new byte[1024];
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("NBIOServer: Caught exception: " + e);
e.printStackTrace();
System.exit(-1);
}
}
}
Example 1
|
Example 2
|
Example 3
|
Example 4
Want to format C# source code automatically? Try SourceFormatX C# Code Formatter Free Trial Now!
|