author | valeriep |
Mon, 07 Jan 2013 11:11:54 -0800 | |
changeset 15008 | 6a494f8ba5b5 |
parent 13992 | d1b65c4e924c |
permissions | -rw-r--r-- |
13992
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
1 |
/* |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
2 |
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
4 |
* |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
10 |
* |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
15 |
* accompanied this code). |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
16 |
* |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
20 |
* |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
23 |
* questions. |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
24 |
*/ |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
25 |
|
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
26 |
package sun.osxapp; |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
27 |
|
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
28 |
import java.io.*; |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
29 |
|
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
30 |
public class ToBin { |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
31 |
public static void main(String[] args) throws Exception { |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
32 |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
33 |
int nRead; |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
34 |
byte[] data = new byte[4096]; |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
35 |
|
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
36 |
while ((nRead = System.in.read(data, 0, data.length)) != -1) { |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
37 |
baos.write(data, 0, nRead); |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
38 |
} |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
39 |
|
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
40 |
baos.flush(); |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
41 |
|
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
42 |
byte[] buf = baos.toByteArray(); |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
43 |
for (int i = 0; i < buf.length; i++) { |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
44 |
System.out.print(String.format("0x%1$02X", buf[i]) + ", "); |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
45 |
if (i % 20 == 0) { |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
46 |
System.out.println(); |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
47 |
} |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
48 |
} |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
49 |
} |
d1b65c4e924c
7179349: [macosx] Java processes on Mac should not use default Apple icon
leonidr
parents:
diff
changeset
|
50 |
} |