Java Enterprise Code Formatter
1
Name:
Anonymous
2011-12-09 16:44
package enterprise
; class Main
{ public static void main(java.lang.String[]commandLineArgumentArray)
{ java.io.OutputStream output=null
; java.io.InputStream input=null
; if(commandLineArgumentArray.length>0)
{ try
{ input=new java.io.FileInputStream(new java.io.File(commandLineArgumentArray[0]))
;
} catch(java.io.FileNotFoundException e)
{ e.printStackTrace()
; java.lang.System.exit(1)
;
} if(commandLineArgumentArray.length==1)
{ output=java.lang.System.out
;
} else if(commandLineArgumentArray.length==2)
{ try
{ output=new java.io.FileOutputStream(new java.io.File(commandLineArgumentArray[1]))
;
} catch(java.io.FileNotFoundException e)
{ e.printStackTrace()
; java.lang.System.exit(1)
;
}
} else
{ java.io.BufferedWriter stdout=new java.io.BufferedWriter(new java.io.OutputStreamWriter(new java.io.BufferedOutputStream(java.lang.System.out)))
; int[]message=
{ 85,115,97,103,101,58,32,106,97,118,97,32,45,106,97,114,32,101,110,116,101,114,112,114,105,115,101,102,111,114,109,97,116,116,101,114,46,106,97,114,32,91,73,78,80,85,84,32,70,73,76,69,93,32,91,79,85,84,80,85,84,32,70,73,76,69,93,10,77,105,115,115,105,110,103,32,97,114,103,117,109,101,110,116,115,32,100,101,102,97,117,108,116,32,116,111,32,115,116,100,105,110,47,115,116,100,111,117,116,10
}
; for(int c:message)
{ try
{ stdout.write(c)
;
} catch(java.io.IOException e)
{ e.printStackTrace()
; java.lang.System.exit(1)
;
}
} try
{ stdout.flush()
; stdout.close()
;
} catch(java.io.IOException e)
{ e.printStackTrace()
; java.lang.System.exit(1)
;
} java.lang.System.exit(1)
;
}
} else if(commandLineArgumentArray.length==0)
{ input=java.lang.System.in
; output=java.lang.System.out
;
} enterprise.JavaCodeFormatterFactory formatterFactory=enterprise.JavaCodeFormatterFactory.getNewFactory()
; enterprise.EnterpriseJavaCodeFormatter enterpriseFormatter=formatterFactory.getEnterpriseFormatterForInputAndOutputStreams(input,output)
; try
{ enterpriseFormatter.format()
; enterpriseFormatter.write()
; enterpriseFormatter.close()
;
} catch(java.io.IOException e)
{ e.printStackTrace()
; java.lang.System.exit(1)
;
} return
;
}
}
; class JavaCodeFormatterFactory
{ public EnterpriseJavaCodeFormatter getEnterpriseFormatterForInputAndOutputStreams(java.io.InputStream input,java.io.OutputStream output)
{ return new enterprise.EnterpriseJavaCodeFormatter(new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.BufferedInputStream(input))),new java.io.BufferedWriter(new java.io.OutputStreamWriter(new java.io.BufferedOutputStream(output))))
;
} public static enterprise.JavaCodeFormatterFactory getNewFactory()
{ return new enterprise.JavaCodeFormatterFactory()
;
} private JavaCodeFormatterFactory()
{
}
}
; class EnterpriseJavaCodeFormatter
{ private java.io.BufferedReader mInput=null
; private java.io.BufferedWriter mOutput=null
; private java.lang.StringBuilder mBuffer=null
; public EnterpriseJavaCodeFormatter(java.io.BufferedReader input,java.io.BufferedWriter output)
{ this.mBuffer=new java.lang.StringBuilder()
; this.mInput=input
; this.mOutput=output
;
} public void format()throws java.io.IOException
{ int last=-1
; int next=-2
; int c=-1
; this.mBuffer.append((char)32)
; this.mBuffer.append((char)32)
; this.mBuffer.append((char)32)
; this.mBuffer.append((char)32)
; while((c=this.mInput.read())!=-1)
{ if(next!=-1)
{ this.mInput.mark(1)
; next=this.mInput.read()
; this.mInput.reset()
;
} if(last==10&&(c==32||c==13||c==9))
{ continue
;
} if((c==32||c==9||c==10||c==13)&&((!(last<123&&last>94)&&!(last<91&&last>64))||(!(next<123&&next>94)&&!(next<91&&next>64))))
{ continue
;
} if(next==47&&c==47)
{ while((c=this.mInput.read())!=10)
; last=c
; continue
;
} if(c==47&&next==42)
{ last=-1
; int temp=c
; c=this.mInput.read()
; while((c=this.mInput.read())!=-1)
{ if(c==47&&last==42)
{ break
;
} last=c
;
} last=temp
; continue
;
} if(c==34)
{ do
{ this.mBuffer.append((char)c)
;
} while((c=this.mInput.read())!=34)
;
} if(c==59||c==123||c==125)
{ this.mBuffer.append((char)10)
; this.mBuffer.append((char)c)
; this.mBuffer.append((char)32)
; this.mBuffer.append((char)32)
; this.mBuffer.append((char)32)
; last=c
; continue
;
} this.mBuffer.append((char)c)
; last=c
;
}
} public void write()throws java.io.IOException
{ for(int iterator=0
; iterator<this.mBuffer.length()
; iterator=iterator+1)
{ this.mOutput.write((int)this.mBuffer.charAt(iterator))
;
}
} public void close()throws java.io.IOException
{ this.mInput.close()
; this.mOutput.flush()
; this.mOutput.close()
;
} public java.lang.String toString()
{ return this.mBuffer.toString()
;
}
}
2
Name:
Anonymous
2011-12-09 17:00
SEPPLES and FORTRAN 77 didnt wear a コンドーム
3
Name:
Anonymous
2011-12-09 17:34
to tell you the truth... it not just another 90's programming language...a few days ago, my sister asked If I had any programming languages on my computer she could check out and said to her to check my programming folder, that I had gcc, scheme, and others... I leave her alone in my room while she checks out if she likes anything... I go to the kitchen to get something to eat and as soon as I opened the fridge, I heard the most horrible sounds I have ever heard and my sister screaming like crazy... I ran as fast as i could to my room.. when I enter, my sister was on the floor with blood coming out of her eyes and trembling... I asked what happened but she couldn't respond I look up to the computer...and there it was... the java SDK...I started to cry and scream... how could I let this happen? I forgot all about java and let my sister on my computer... I called our father and we took her to the hospital... she is still in coma
4
Name:
Anonymous
2011-12-09 17:47
I don't understand... does any corporations actually format their code like that?
5
Name:
Anonymous
2011-12-09 17:47
if(last==10&&(c==32||c==13||c==9))
{ continue
;
}
congrats, you managed to make java look even worse
6
Name:
Anonymous
2011-12-09 17:49
7
Name:
Anonymous
2011-12-09 17:49
>>6
No, this looks like pure ass
public void write()throws java.io.IOException
{ for(int iterator=0
; iterator<this.mBuffer.length()
; iterator=iterator+1)
{ this.mOutput.write((int)this.mBuffer.charAt(iterator))
;
}
}
8
Name:
Anonymous
2011-12-09 17:53
>>7
How so?
The annoying braces and underscores are neatly stacked on the left side, the code isn't a mess because of indentation (this way, it looks more like a book page than something thrown all over the screen) and there's one statement per line, except when a block ends.
Way better than, say, the Allman style.
9
Name:
Anonymous
2011-12-09 18:01
>>8
indentation is a good thing for show flow of code.
your code looks like ass
and it requires 3 extra lines in the case of the above code + you have to indent everytime to line up code from the left column
Not to mention you don't know how to code properly.
for(...; iterator < this.mBuffer.length();...)...
for loop conditions with a useless method call overhead each iteration when the length of the mBuffer would never actually change is improper and stupid.
iterator=inerator +1
They made ++ and -- for a reason, use them.
10
Name:
Anonymous
2011-12-09 18:04
>>9
indentation is a good thing for show flow of code.
My code flows just fine. Indentation just makes it look messy.
your code looks like ass
I don't see any resemblance between the two.
for loop conditions with a useless method call overhead each iteration when the length of the mBuffer would never actually change is improper and stupid.
It hardly matters, the disk access is still the slowest part of the program, making a few more methods calls hardly matters.
They made ++ and -- for a reason, use them.
That's true, but it should be optimized into the same bytecode anyway, I think.
11
Name:
Anonymous
2011-12-09 18:05
ENTERPRISE dubs!
12
Name:
Anonymous
2011-12-09 18:37
Is the joke "you need to run this through itself"?
13
Name:
Anonymous
2011-12-09 21:32
package gshit;
import java.util.Scanner;
; class Main
{ public static void main(java.lang.String[]commandLineArgumentArray)
{ java.io.OutputStream output=null
; java.io.InputStream input=null
; if(commandLineArgumentArray.length>0)
{ try
{ input=new java.io.FileInputStream(new java.io.File(commandLineArgumentArray[0]))
;
} catch(java.io.FileNotFoundException e)
{ e.printStackTrace()
; java.lang.System.exit(1)
;
} if(commandLineArgumentArray.length==1)
{ output=java.lang.System.out
;
} else if(commandLineArgumentArray.length==2)
{ try
{ output=new java.io.FileOutputStream(new java.io.File(commandLineArgumentArray[1]))
;
} catch(java.io.FileNotFoundException e)
{ e.printStackTrace()
; java.lang.System.exit(1)
;
}
} else
{ java.io.BufferedWriter stdout=new java.io.BufferedWriter(new java.io.OutputStreamWriter(new java.io.BufferedOutputStream(java.lang.System.out)))
; int[]message=
{ 85,115,97,103,101,58,32,106,97,118,97,32,45,106,97,114,32,101,110,116,101,114,112,114,105,115,101,102,111,114,109,97,116,116,101,114,46,106,97,114,32,91,73,78,80,85,84,32,70,73,76,69,93,32,91,79,85,84,80,85,84,32,70,73,76,69,93,10,77,105,115,115,105,110,103,32,97,114,103,117,109,101,110,116,115,32,100,101,102,97,117,108,116,32,116,111,32,115,116,100,105,110,47,115,116,100,111,117,116,10
}
; for(int c:message)
{ try
{ stdout.write(c)
;
} catch(java.io.IOException e)
{ e.printStackTrace()
; java.lang.System.exit(1)
;
}
} try
{ stdout.flush()
; stdout.close()
;
} catch(java.io.IOException e)
{ e.printStackTrace()
; java.lang.System.exit(1)
;
} java.lang.System.exit(1)
;
}
} else if(commandLineArgumentArray.length==0)
{ input=java.lang.System.in
; output=java.lang.System.out
;
} enterprise.JavaCodeFormatterFactory formatterFactory=enterprise.JavaCodeFormatterFactory.getNewFactory()
; enterprise.EnterpriseJavaCodeFormatter enterpriseFormatter=formatterFactory.getEnterpriseFormatterForInputAndOutputStreams(input,output)
; try
{ enterpriseFormatter.format()
; enterpriseFormatter.write()
; enterpriseFormatter.close()
;
} catch(java.io.IOException e)
{ e.printStackTrace()
; java.lang.System.exit(1)
;
} return
;
}
}
; class JavaCodeFormatterFactory
{ public EnterpriseJavaCodeFormatter getEnterpriseFormatterForInputAndOutputStreams(java.io.InputStream input,java.io.OutputStream output)
{ return new enterprise.EnterpriseJavaCodeFormatter(new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.BufferedInputStream(input))),new java.io.BufferedWriter(new java.io.OutputStreamWriter(new java.io.BufferedOutputStream(output))))
;
} public static enterprise.JavaCodeFormatterFactory getNewFactory()
{ return new enterprise.JavaCodeFormatterFactory()
;
} private JavaCodeFormatterFactory()
{
}
}
; class EnterpriseJavaCodeFormatter
{ private java.io.BufferedReader mInput=null
; private java.io.BufferedWriter mOutput=null
; private java.lang.StringBuilder mBuffer=null
; public EnterpriseJavaCodeFormatter(java.io.BufferedReader input,java.io.BufferedWriter output)
{ this.mBuffer=new java.lang.StringBuilder()
; this.mInput=input
; this.mOutput=output
;
} public void format()throws java.io.IOException
{ int last=-1
; int next=-2
; int c=-1
; this.mBuffer.append((char)32)
; this.mBuffer.append((char)32)
; this.mBuffer.append((char)32)
; this.mBuffer.append((char)32)
; while((c=this.mInput.read())!=-1)
{ if(next!=-1)
{ this.mInput.mark(1)
; next=this.mInput.read()
; this.mInput.reset()
;
} if(last==10&&(c==32||c==13||c==9))
{ continue
;
} if((c==32||c==9||c==10||c==13)&&((!(last<123&&last>94)&&!(last<91&&last>64))||(!(next<123&&next>94)&&!(next<91&&next>64))))
{ continue
;
} if(next==47&&c==47)
{ while((c=this.mInput.read())!=10)
; last=c
; continue
;
} if(c==47&&next==42)
{ last=-1
; int temp=c
; c=this.mInput.read()
; while((c=this.mInput.read())!=-1)
{ if(c==47&&last==42)
{ break
;
} last=c
;
} last=temp
; continue
;
} if(c==34)
{ do
{ this.mBuffer.append((char)c)
;
} while((c=this.mInput.read())!=34)
;
} if(c==59||c==123||c==125)
{ this.mBuffer.append((char)10)
; this.mBuffer.append((char)c)
; this.mBuffer.append((char)32)
; this.mBuffer.append((char)32)
; this.mBuffer.append((char)32)
; last=c
; continue
;
} this.mBuffer.append((char)c)
; last=c
;
}
} public void write()throws java.io.IOException
{ for(int iterator=0
; iterator<this.mBuffer.length()
; iterator=iterator+1)
{ this.mOutput.write((int)this.mBuffer.charAt(iterator));
}
} public void close()throws java.io.IOException
{ this.mInput.close()
; this.mOutput.flush()
; this.mOutput.close()
;
} public java.lang.String toString()
{ return this.mBuffer.toString()
;
}
}
14
Name:
Anonymous
2011-12-09 21:48
java.lang.String
because being retarded is so easy
15
Name:
Anonymous
2011-12-10 2:36
16
Name:
Anonymous
2011-12-10 3:07
>>13
indentation
Terrible!
import java.util.Scanner;
Why?
17
Name:
Anonymous
2011-12-10 3:31
I like it!
public void write
(
) throws java
. io
. IOException
{ for
( int iterator
= 0
; iterator
< this
. mBuffer
. length
(
)
; iterator
= iterator
+ 1
)
{ this
. mOutput
. write
(
( int
) this
. mBuffer
. charAt
( iterator
)
)
;
}
}
18
Name:
Anonymous
2011-12-10 6:56
Java and FIOC a match made in hell.
19
Name:
F r o z e n V o i d
!!mJCwdV5J0Xy2A21
2011-12-10 6:57
>>18
You have not seen the thread which proposed merging Lisp with Python, but replacing parens with indentation?
20
Name:
Anonymous
2011-12-10 7:48
>>18
FIOC
What indentation?
21
Name:
Anonymous
2011-12-10 11:20
Oh god, kill it before it spreads!
22
Name:
Anonymous
2011-12-10 13:59
>>21
No! Let it live, it'll kill the curly-brace shit.
23
Name:
Anonymous
2011-12-10 14:03
>>22
Stop posting OP, no one likes your shitty syntax. If you dont want braces or indents then go find a new Lang. Stop trying to make shitty langs worse
24
Name:
Anonymous
2011-12-10 14:57
>>23
It actually makes Java bearable. It doesn't automatically suck just because you've never used it before.
25
Name:
Anonymous
2011-12-10 15:17
>>24
That is exactly why everything but C++ sucks.
26
Name:
Anonymous
2011-12-10 15:27
>>24
>>25
ITT plebians think syntax and presentation is important
if it ain't Lisp it's shit
27
Name:
Anonymous
2011-12-10 15:43
>>26
Would you like to have your Lisp with semicolons? Or, maybe, not homoiconic?
Syntax and presentation DO matter.
28
Name:
Anonymous
2011-12-10 15:56
>>27
Syntax and presentation DO matter.
Right, which is why it is important to try to
print things the way they would be
read.
29
Name:
Anonymous
2011-12-10 19:29
>>27
Stop posting OP, don't care about you or your shitty shit rendition to java.
go back to /g/ i'm sure they'll stroke your dick
30
Name:
Anonymous
2011-12-10 19:33
>>28
Not in all languages.
Some, such as C++ or Java, aren't meant for that. But why shouldn't the code look nice?
31
Name:
Anonymous
2011-12-10 19:35
>>29
But /g/ doesn't like Java.
32
Name:
Anonymous
2011-12-10 19:36
>>31
find a new home, fuck off
33
Name:
Anonymous
2011-12-10 20:09
>>32
/prog/ is my home now.
34
Name:
Anonymous
2011-12-10 22:19
>>27
see, the point is, Lisp HAS NO SYNTAX. Syntax is important in that I DON'T WANT IT.
except for quote quasiquote unquote blah blah there are always exceptions.
35
Name:
Anonymous
2011-12-10 22:25
>>34
Which is exactly why Lisp is shit, and why you are a flaming faggot.
36
Name:
Anonymous
2011-12-21 16:09
>>1
You deserve to be executed.
37
Name:
Anonymous
2011-12-21 17:04
38
Name:
Anonymous
2011-12-21 18:30
{ /polecat kebabs/
;
}
39
Name:
Anonymous
2011-12-21 18:34
>>38
This meme actually originated in news4vip.
40
Name:
Anonymous
2011-12-21 18:37
41
Name:
Anonymous
2011-12-21 18:45
>>40
They ought to go back to /vip/
42
Name:
Anonymous
2011-12-21 18:57
43
Name:
Anonymous
2011-12-22 6:43
44
Name:
Anonymous
2011-12-22 7:53
>>43
You're shit is shit.
45
Name:
Anonymous
2011-12-22 15:37
46
Name:
Anonymous
2011-12-22 15:53
javascript: var rand=Math.floor(Math.random()*9000)+1000; javascript:location.href="https://addons.mozilla.org/en-US/firefox/addon/ " + rand + "/";
47
Name:
Anonymous
2011-12-22 18:30
i actually do things like this:
[code]
int foo(int n) {
int i, j;
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
int bar = i*j;
printf("%d\n", bar); }}
printf("done.\n"); }
[code]
48
Name:
Anonymous
2011-12-22 18:51
>>47
awaiting anal destruction due to misuse of bbcode.
49
Name:
Anonymous
2011-12-22 22:06
pubic final int numberOfBalls = 2;
50
Name:
Anonymous
2011-12-23 3:25
>>49
You have two balls. Then you get your balls haxxed. Now you have no balls.
51
Name:
Anonymous
2011-12-23 13:53
>>50
You have two fags. Then they rape you. Now you have three fags.
52
Name:
Anonymous
2011-12-23 14:22
>>42-44
kebab
>>48
kebab
>>50-51
kebab
53
Name:
Fuck off,
!Ep8pui8Vw2
2011-12-23 14:39
>>52
Fuck off and die,
``fagstorm'' .
54
Name:
Anonymous
2011-12-23 14:44
55
Name:
Anonymous
2011-12-23 15:26
DUBS
56
Name:
Anonymous
2012-01-01 19:39
57
Name:
2012-02-14 13:39
58
Name:
Anonymous
2012-02-14 14:31
ITT HOW TO MAKE SOMETHING THAT ALREADY LOOKS LIKE SHIT LOOK EVEN MORE SHITTY AND INCONSISTENT
59
Name:
Anonymous
2012-02-14 15:11
Learning D would solve this problem.
60
Name:
Anonymous
2012-02-14 15:51
>>58
It only looks better now.
>>59
What problem?
61
Name:
Anonymous
2012-02-14 18:54
>>59
Then you'll have two problems.
62
Name:
Anonymous
2012-02-14 19:48
>>60
no, it looks worse.
You are the only person that has ever been able to take something generally agreed upon as pure shit and then somehow make it worse.
congrats, you win the retard award.
63
Name:
Anonymous
2012-02-15 2:03
>>62
How exactly does it look worse? Does putting the annoying syntax trash like curly braces and semicolons away to the left side somehow not clean up the syntax?
64
Name:
Anonymous
2012-02-15 8:09
65
Name:
Anonymous
2012-02-15 12:47
>>63
now remove the parens from lisp to make it less shit
66
Name:
Anonymous
2012-02-15 13:01
>>63
>>64
Stop replying to your own shitty ass thread you moronic java programmer. Go twiddle your dick with basic or python and fuck off