Crossfire JXClient, Trunk
Demo.java
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * - Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * - Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * - Neither the name of Oracle nor the names of its
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * This source code is provided to illustrate the usage of a given feature
34  * or technique and has been deliberately simplified. Additional steps
35  * required for a production-quality application, such as security checks,
36  * input validation and proper error handling, might not be present in
37  * this sample code.
38  */
39 
40 
41 import java.io.*;
42 import java.nio.*;
43 import java.nio.channels.*;
44 import java.nio.file.*;
45 import java.nio.file.spi.*;
46 import java.nio.file.attribute.*;
47 import java.net.*;
48 import java.text.DateFormat;
49 import java.text.SimpleDateFormat;
50 import java.util.*;
51 
52 import static java.nio.file.StandardOpenOption.*;
53 import static java.nio.file.StandardCopyOption.*;
54 /*
55  * ZipFileSystem usage demo
56  *
57  * java Demo action ZipfileName [...]
58  *
59  * @author Xueming Shen
60  */
61 
62 public class Demo {
63 
64  static enum Action {
65  rename, // <java Demo rename zipfile src dst>
66  // rename entry src to dst inside zipfile
67 
68  movein, // <java Demo movein zipfile src dst>
69  // move an external src file into zipfile
70  // as entry dst
71 
72  moveout, // <java Demo moveout zipfile src dst>
73  // move a zipfile entry src out to dst
74 
75  copy, // <java Demo copy zipfile src dst>
76  // copy entry src to dst inside zipfile
77 
78  copyin, // <java Demo copyin zipfile src dst>
79  // copy an external src file into zipfile
80  // as entry dst
81 
82  copyin_attrs, // <java Demo copyin_attrs zipfile src dst>
83  // copy an external src file into zipfile
84  // as entry dst, with attributes (timestamp)
85 
86  copyout, // <java Demo copyout zipfile src dst>
87  // copy zipfile entry src" out to file dst
88 
89  copyout_attrs, // <java Demo copyout_attrs zipfile src dst>
90 
91  zzmove, // <java Demo zzmove zfsrc zfdst path>
92  // move entry path/dir from zfsrc to zfdst
93 
94  zzcopy, // <java Demo zzcopy zfsrc zfdst path>
95  // copy path from zipfile zfsrc to zipfile
96  // zfdst
97 
98  attrs, // <java Demo attrs zipfile path>
99  // printout the attributes of entry path
100 
101  attrsspace, // <java Demo attrsspace zipfile path>
102  // printout the storespace attrs of entry path
103 
104  setmtime, // <java Demo setmtime zipfile "MM/dd/yy-HH:mm:ss" path...>
105  // set the lastModifiedTime of entry path
106 
107  setatime, // <java Demo setatime zipfile "MM/dd/yy-HH:mm:ss" path...>
108  setctime, // <java Demo setctime zipfile "MM/dd/yy-HH:mm:ss" path...>
109 
110  lsdir, // <java Demo lsdir zipfile dir>
111  // list dir's direct child files/dirs
112 
113  mkdir, // <java Demo mkdir zipfile dir>
114 
115  mkdirs, // <java Demo mkdirs zipfile dir>
116 
117  rmdirs, // <java Demo rmdirs zipfile dir>
118 
119  list, // <java Demo list zipfile [dir]>
120  // recursively list all entries of dir
121  // via DirectoryStream
122 
123  tlist, // <java Demo tlist zipfile [dir]>
124  // list with buildDirTree=true
125 
126  vlist, // <java Demo vlist zipfile [dir]>
127  // recursively verbose list all entries of
128  // dir via DirectoryStream
129 
130  walk, // <java Demo walk zipfile [dir]>
131  // recursively walk all entries of dir
132  // via Files.walkFileTree
133 
134  twalk, // <java Demo twalk zipfile [dir]>
135  // walk with buildDirTree=true
136 
137  extract, // <java Demo extract zipfile file [...]>
138 
139  update, // <java Demo extract zipfile file [...]>
140 
141  delete, // <java Demo delete zipfile file [...]>
142 
143  add, // <java Demo add zipfile file [...]>
144 
145  create, // <java Demo create zipfile file [...]>
146  // create a new zipfile if it doesn't exit
147  // and then add the file(s) into it.
148 
149  attrs2, // <java Demo attrs2 zipfile file [...]>
150  // test different ways to print attrs
151 
153  }
154 
155  public static void main(String[] args) throws Throwable {
156  FileSystemProvider provider = getZipFSProvider();
157  if (provider == null) {
158  System.err.println("ZIP filesystem provider is not installed");
159  System.exit(1);
160  }
161 
162  Action action = Action.valueOf(args[0]);
163  Map<String, Object> env = env = new HashMap<>();
164  if (action == Action.create)
165  env.put("create", "true");
166  try (FileSystem fs = provider.newFileSystem(Paths.get(args[1]), env)) {
167  Path path, src, dst;
168  switch (action) {
169  case rename:
170  src = fs.getPath(args[2]);
171  dst = fs.getPath(args[3]);
172  Files.move(src, dst);
173  break;
174  case moveout:
175  src = fs.getPath(args[2]);
176  dst = Paths.get(args[3]);
177  Files.move(src, dst);
178  break;
179  case movein:
180  src = Paths.get(args[2]);
181  dst = fs.getPath(args[3]);
182  Files.move(src, dst);
183  break;
184  case copy:
185  src = fs.getPath(args[2]);
186  dst = fs.getPath(args[3]);
187  Files.copy(src, dst);
188  break;
189  case copyout:
190  src = fs.getPath(args[2]);
191  dst = Paths.get(args[3]);
192  Files.copy(src, dst);
193  break;
194  case copyin:
195  src = Paths.get(args[2]);
196  dst = fs.getPath(args[3]);
197  Files.copy(src, dst);
198  break;
199  case copyin_attrs:
200  src = Paths.get(args[2]);
201  dst = fs.getPath(args[3]);
202  Files.copy(src, dst, COPY_ATTRIBUTES);
203  break;
204  case copyout_attrs:
205  src = fs.getPath(args[2]);
206  dst = Paths.get(args[3]);
207  Files.copy(src, dst, COPY_ATTRIBUTES);
208  break;
209  case zzmove:
210  try (FileSystem fs2 = provider.newFileSystem(Paths.get(args[2]), env)) {
211  z2zmove(fs, fs2, args[3]);
212  }
213  break;
214  case zzcopy:
215  try (FileSystem fs2 = provider.newFileSystem(Paths.get(args[2]), env)) {
216  z2zcopy(fs, fs2, args[3]);
217  }
218  break;
219  case attrs:
220  for (int i = 2; i < args.length; i++) {
221  path = fs.getPath(args[i]);
222  System.out.println(path);
223  System.out.println(
224  Files.readAttributes(path, BasicFileAttributes.class).toString());
225  }
226  break;
227  case setmtime:
228  DateFormat df = new SimpleDateFormat("MM/dd/yyyy-HH:mm:ss");
229  Date newDatetime = df.parse(args[2]);
230  for (int i = 3; i < args.length; i++) {
231  path = fs.getPath(args[i]);
232  Files.setAttribute(path, "lastModifiedTime",
233  FileTime.fromMillis(newDatetime.getTime()));
234  System.out.println(
235  Files.readAttributes(path, BasicFileAttributes.class).toString());
236  }
237  break;
238  case setctime:
239  df = new SimpleDateFormat("MM/dd/yyyy-HH:mm:ss");
240  newDatetime = df.parse(args[2]);
241  for (int i = 3; i < args.length; i++) {
242  path = fs.getPath(args[i]);
243  Files.setAttribute(path, "creationTime",
244  FileTime.fromMillis(newDatetime.getTime()));
245  System.out.println(
246  Files.readAttributes(path, BasicFileAttributes.class).toString());
247  }
248  break;
249  case setatime:
250  df = new SimpleDateFormat("MM/dd/yyyy-HH:mm:ss");
251  newDatetime = df.parse(args[2]);
252  for (int i = 3; i < args.length; i++) {
253  path = fs.getPath(args[i]);
254  Files.setAttribute(path, "lastAccessTime",
255  FileTime.fromMillis(newDatetime.getTime()));
256  System.out.println(
257  Files.readAttributes(path, BasicFileAttributes.class).toString());
258  }
259  break;
260  case attrsspace:
261  path = fs.getPath("/");
262  FileStore fstore = Files.getFileStore(path);
263  System.out.printf("filestore[%s]%n", fstore.name());
264  System.out.printf(" totalSpace: %d%n",
265  (Long)fstore.getAttribute("totalSpace"));
266  System.out.printf(" usableSpace: %d%n",
267  (Long)fstore.getAttribute("usableSpace"));
268  System.out.printf(" unallocSpace: %d%n",
269  (Long)fstore.getAttribute("unallocatedSpace"));
270  break;
271  case list:
272  case tlist:
273  if (args.length < 3)
274  list(fs.getPath("/"), false);
275  else
276  list(fs.getPath(args[2]), false);
277  break;
278  case vlist:
279  if (args.length < 3)
280  list(fs.getPath("/"), true);
281  else
282  list(fs.getPath(args[2]), true);
283  break;
284  case twalk:
285  case walk:
286  walk(fs.getPath((args.length > 2)? args[2] : "/"));
287  break;
288  case extract:
289  if (args.length == 2) {
290  extract(fs, "/");
291  } else {
292  for (int i = 2; i < args.length; i++) {
293  extract(fs, args[i]);
294  }
295  }
296  break;
297  case delete:
298  for (int i = 2; i < args.length; i++)
299  Files.delete(fs.getPath(args[i]));
300  break;
301  case create:
302  case add:
303  case update:
304  for (int i = 2; i < args.length; i++) {
305  update(fs, args[i]);
306  }
307  break;
308  case lsdir:
309  path = fs.getPath(args[2]);
310  final String fStr = (args.length > 3)?args[3]:"";
311  try (DirectoryStream<Path> ds = Files.newDirectoryStream(path,
312  new DirectoryStream.Filter<Path>() {
313  @Override
314  public boolean accept(Path path) {
315  return path.toString().contains(fStr);
316  }
317  }))
318  {
319  for (Path p : ds)
320  System.out.println(p);
321  }
322  break;
323  case mkdir:
324  Files.createDirectory(fs.getPath(args[2]));
325  break;
326  case mkdirs:
327  mkdirs(fs.getPath(args[2]));
328  break;
329  case attrs2:
330  for (int i = 2; i < args.length; i++) {
331  path = fs.getPath(args[i]);
332  System.out.printf("%n%s%n", path);
333  System.out.println("-------(1)---------");
334  System.out.println(
335  Files.readAttributes(path, BasicFileAttributes.class).toString());
336  System.out.println("-------(2)---------");
337  Map<String, Object> map = Files.readAttributes(path, "zip:*");
338  for (Map.Entry<String, Object> e : map.entrySet()) {
339  System.out.printf(" %s : %s%n", e.getKey(), e.getValue());
340  }
341  System.out.println("-------(3)---------");
342  map = Files.readAttributes(path, "size,lastModifiedTime,isDirectory");
343  for (Map.Entry<String, ?> e : map.entrySet()) {
344  System.out.printf(" %s : %s%n", e.getKey(), e.getValue());
345  }
346  }
347  break;
348  case prof:
349  list(fs.getPath("/"), false);
350  while (true) {
351  Thread.sleep(10000);
352  //list(fs.getPath("/"), true);
353  System.out.println("sleeping...");
354  }
355  }
356  } catch (Exception x) {
357  x.printStackTrace();
358  }
359  }
360 
361  private static FileSystemProvider getZipFSProvider() {
362  for (FileSystemProvider provider : FileSystemProvider.installedProviders()) {
363  if ("jar".equals(provider.getScheme()))
364  return provider;
365  }
366  return null;
367  }
368 
369  @SuppressWarnings("unused")
373  private static byte[] getBytes(String name) {
374  return name.getBytes();
375  }
376 
377  @SuppressWarnings("unused")
381  private static String getString(byte[] name) {
382  return new String(name);
383  }
384 
385  private static void walk(Path path) throws IOException
386  {
387  Files.walkFileTree(
388  path,
389  new SimpleFileVisitor<Path>() {
390  private int indent = 0;
391  private void indent() {
392  int n = 0;
393  while (n++ < indent)
394  System.out.printf(" ");
395  }
396 
397  @Override
398  public FileVisitResult visitFile(Path file,
399  BasicFileAttributes attrs)
400  {
401  indent();
402  System.out.printf("%s%n", file.getFileName().toString());
403  return FileVisitResult.CONTINUE;
404  }
405 
406  @Override
407  public FileVisitResult preVisitDirectory(Path dir,
408  BasicFileAttributes attrs)
409  {
410  indent();
411  System.out.printf("[%s]%n", dir.toString());
412  indent += 2;
413  return FileVisitResult.CONTINUE;
414  }
415 
416  @Override
417  public FileVisitResult postVisitDirectory(Path dir,
418  IOException ioe)
419  {
420  indent -= 2;
421  return FileVisitResult.CONTINUE;
422  }
423  });
424  }
425 
426  private static void update(FileSystem fs, String path) throws Throwable{
427  Path src = FileSystems.getDefault().getPath(path);
428  if (Files.isDirectory(src)) {
429  try (DirectoryStream<Path> ds = Files.newDirectoryStream(src)) {
430  for (Path child : ds)
431  update(fs, child.toString());
432  }
433  } else {
434  Path dst = fs.getPath(path);
435  Path parent = dst.getParent();
436  if (parent != null && Files.notExists(parent))
437  mkdirs(parent);
438  Files.copy(src, dst, REPLACE_EXISTING);
439  }
440  }
441 
442  private static void extract(FileSystem fs, String path) throws Throwable{
443  Path src = fs.getPath(path);
444  if (Files.isDirectory(src)) {
445  try (DirectoryStream<Path> ds = Files.newDirectoryStream(src)) {
446  for (Path child : ds)
447  extract(fs, child.toString());
448  }
449  } else {
450  if (path.startsWith("/"))
451  path = path.substring(1);
452  Path dst = FileSystems.getDefault().getPath(path);
453  Path parent = dst.getParent();
454  if (Files.notExists(parent))
455  mkdirs(parent);
456  Files.copy(src, dst, REPLACE_EXISTING);
457  }
458  }
459 
460  // use DirectoryStream
461  private static void z2zcopy(FileSystem src, FileSystem dst, String path)
462  throws IOException
463  {
464  Path srcPath = src.getPath(path);
465  Path dstPath = dst.getPath(path);
466 
467  if (Files.isDirectory(srcPath)) {
468  if (!Files.exists(dstPath)) {
469  try {
470  mkdirs(dstPath);
471  } catch (FileAlreadyExistsException x) {}
472  }
473  try (DirectoryStream<Path> ds = Files.newDirectoryStream(srcPath)) {
474  for (Path child : ds) {
475  z2zcopy(src, dst,
476  path + (path.endsWith("/")?"":"/") + child.getFileName());
477  }
478  }
479  } else {
480  //System.out.println("copying..." + path);
481  Files.copy(srcPath, dstPath);
482  }
483  }
484 
485  // use TreeWalk to move
486  private static void z2zmove(FileSystem src, FileSystem dst, String path)
487  throws IOException
488  {
489  final Path srcPath = src.getPath(path).toAbsolutePath();
490  final Path dstPath = dst.getPath(path).toAbsolutePath();
491 
492  Files.walkFileTree(srcPath, new SimpleFileVisitor<Path>() {
493 
494  @Override
495  public FileVisitResult visitFile(Path file,
496  BasicFileAttributes attrs)
497  {
498  Path dst = srcPath.relativize(file);
499  dst = dstPath.resolve(dst);
500  try {
501  Path parent = dstPath.getParent();
502  if (parent != null && Files.notExists(parent))
503  mkdirs(parent);
504  Files.move(file, dst);
505  } catch (IOException x) {
506  x.printStackTrace();
507  }
508  return FileVisitResult.CONTINUE;
509  }
510 
511  @Override
512  public FileVisitResult preVisitDirectory(Path dir,
513  BasicFileAttributes attrs)
514  {
515  Path dst = srcPath.relativize(dir);
516  dst = dstPath.resolve(dst);
517  try {
518 
519  if (Files.notExists(dst))
520  mkdirs(dst);
521  } catch (IOException x) {
522  x.printStackTrace();
523  }
524  return FileVisitResult.CONTINUE;
525  }
526 
527  @Override
528  public FileVisitResult postVisitDirectory(Path dir,
529  IOException ioe)
530  throws IOException
531  {
532  try {
533  Files.delete(dir);
534  } catch (IOException x) {
535  //x.printStackTrace();
536  }
537  return FileVisitResult.CONTINUE;
538  }
539  });
540 
541  }
542 
543  private static void mkdirs(Path path) throws IOException {
544  path = path.toAbsolutePath();
545  Path parent = path.getParent();
546  if (parent != null) {
547  if (Files.notExists(parent))
548  mkdirs(parent);
549  }
550  Files.createDirectory(path);
551  }
552 
553  @SuppressWarnings("unused")
557  private static void rmdirs(Path path) throws IOException {
558  while (path != null && path.getNameCount() != 0) {
559  Files.delete(path);
560  path = path.getParent();
561  }
562  }
563 
564  private static void list(Path path, boolean verbose ) throws IOException {
565  if (!"/".equals(path.toString())) {
566  System.out.printf(" %s%n", path.toString());
567  if (verbose)
568  System.out.println(Files.readAttributes(path, BasicFileAttributes.class).toString());
569  }
570  if (Files.notExists(path))
571  return;
572  if (Files.isDirectory(path)) {
573  try (DirectoryStream<Path> ds = Files.newDirectoryStream(path)) {
574  for (Path child : ds)
575  list(child, verbose);
576  }
577  }
578  }
579 
580  @SuppressWarnings("unused")
585  private static void checkEqual(Path src, Path dst) throws IOException
586  {
587  //System.out.printf("checking <%s> vs <%s>...%n",
588  // src.toString(), dst.toString());
589 
590  //streams
591  byte[] bufSrc = new byte[8192];
592  byte[] bufDst = new byte[8192];
593  try (InputStream isSrc = Files.newInputStream(src);
594  InputStream isDst = Files.newInputStream(dst))
595  {
596  int nSrc = 0;
597  while ((nSrc = isSrc.read(bufSrc)) != -1) {
598  int nDst = 0;
599  while (nDst < nSrc) {
600  int n = isDst.read(bufDst, nDst, nSrc - nDst);
601  if (n == -1) {
602  System.out.printf("checking <%s> vs <%s>...%n",
603  src.toString(), dst.toString());
604  throw new RuntimeException("CHECK FAILED!");
605  }
606  nDst += n;
607  }
608  while (--nSrc >= 0) {
609  if (bufSrc[nSrc] != bufDst[nSrc]) {
610  System.out.printf("checking <%s> vs <%s>...%n",
611  src.toString(), dst.toString());
612  throw new RuntimeException("CHECK FAILED!");
613  }
614  nSrc--;
615  }
616  }
617  }
618 
619  // channels
620 
621  try (SeekableByteChannel chSrc = Files.newByteChannel(src);
622  SeekableByteChannel chDst = Files.newByteChannel(dst))
623  {
624  if (chSrc.size() != chDst.size()) {
625  System.out.printf("src[%s].size=%d, dst[%s].size=%d%n",
626  chSrc.toString(), chSrc.size(),
627  chDst.toString(), chDst.size());
628  throw new RuntimeException("CHECK FAILED!");
629  }
630  ByteBuffer bbSrc = ByteBuffer.allocate(8192);
631  ByteBuffer bbDst = ByteBuffer.allocate(8192);
632 
633  int nSrc = 0;
634  while ((nSrc = chSrc.read(bbSrc)) != -1) {
635  int nDst = chDst.read(bbDst);
636  if (nSrc != nDst) {
637  System.out.printf("checking <%s> vs <%s>...%n",
638  src.toString(), dst.toString());
639  throw new RuntimeException("CHECK FAILED!");
640  }
641  while (--nSrc >= 0) {
642  if (bbSrc.get(nSrc) != bbDst.get(nSrc)) {
643  System.out.printf("checking <%s> vs <%s>...%n",
644  src.toString(), dst.toString());
645  throw new RuntimeException("CHECK FAILED!");
646  }
647  nSrc--;
648  }
649  bbSrc.flip();
650  bbDst.flip();
651  }
652  } catch (IOException x) {
653  x.printStackTrace();
654  }
655  }
656 
657  private static void fchCopy(Path src, Path dst) throws IOException
658  {
659  Set<OpenOption> read = new HashSet<>();
660  read.add(READ);
661  Set<OpenOption> openwrite = new HashSet<>();
662  openwrite.add(CREATE_NEW);
663  openwrite.add(WRITE);
664 
665  try (FileChannel srcFc = src.getFileSystem().provider().newFileChannel(src, read);
666  FileChannel dstFc = dst.getFileSystem().provider().newFileChannel(dst, openwrite))
667  {
668  ByteBuffer bb = ByteBuffer.allocate(8192);
669  while (srcFc.read(bb) >= 0) {
670  bb.flip();
671  dstFc.write(bb);
672  bb.clear();
673  }
674  }
675  }
676 
677  private static void chCopy(Path src, Path dst) throws IOException
678  {
679  Set<OpenOption> read = new HashSet<>();
680  read.add(READ);
681  Set<OpenOption> openwrite = new HashSet<>();
682  openwrite.add(CREATE_NEW);
683  openwrite.add(WRITE);
684 
685  try (SeekableByteChannel srcCh = Files.newByteChannel(src, read);
686  SeekableByteChannel dstCh = Files.newByteChannel(dst, openwrite))
687  {
688  ByteBuffer bb = ByteBuffer.allocate(8192);
689  while (srcCh.read(bb) >= 0) {
690  bb.flip();
691  dstCh.write(bb);
692  bb.clear();
693  }
694  }
695  }
696 
697  private static void streamCopy(Path src, Path dst) throws IOException
698  {
699  byte[] buf = new byte[8192];
700  try (InputStream isSrc = Files.newInputStream(src);
701  OutputStream osDst = Files.newOutputStream(dst))
702  {
703  int n = 0;
704  while ((n = isSrc.read(buf)) != -1) {
705  osDst.write(buf, 0, n);
706  }
707  }
708  }
709 }
Demo.main
static void main(String[] args)
Definition: Demo.java:155
runner
in the editor and run the same with Tools Run menu You will see an alert box with the message world In addition to being a simple script editor runner
Definition: README.txt:32
Some
NetBeans Project Files for JDK Demos This directory contains project files for the NetBeans IDE for the all Java JDK to bring up the Java2D demo in do the download it from choose File Open Project In the popup navigate to the JDK distribution and within that to the demo directory Press the Open Project Folder button That will open all of the e g Clean and Build Project and then Run Project Some
Definition: README.txt:22
file
Once a FileSystem is created then classes in the java nio file package can be used to access files in the zip JAR file
Definition: README.txt:19
eg
Once a FileSystem is created then classes in the java nio file package can be used to access files in the zip JAR eg
Definition: README.txt:21
given
the functions do not always return the right values for PostScript fonts There are still some bugs around the error handling Most of these problems will usually get fixed when some parameters are or the screen is refreshed Many fonts on Solaris fails to retrieve outlines and as the they do not align within the grid properly These are mainly F3 and fonts that was returned by X server When showWindowWithoutWarningBanner AWTPermission is not given
Definition: README.txt:148
Demo.list
static void list(Path path, boolean verbose)
Definition: Demo.java:564
font
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular font
Definition: README.txt:44
Demo.walk
static void walk(Path path)
Definition: Demo.java:385
Demo.Action.attrsspace
attrsspace
Definition: Demo.java:101
path
where< script-file-path > is the path of your script file to load If you don t specify the file path
Definition: README.txt:50
Java
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the Java(TM) SE Development Kit. To view Font2DTest within a web browser with Java Plugin
TableExample2
The four examples in this directory show how to use some of the features of the JTable component which has a TextArea that can be used as an editor for an SQL expression Pressing the Fetch button sends the expression to the database The results are displayed in the JTable underneath the text area To run TableExample and TableExample2
Definition: README.txt:24
Demo.Action.attrs2
attrs2
Definition: Demo.java:149
Demo.Action.lsdir
lsdir
Definition: Demo.java:110
N2
Definition: N2.java:48
However
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an it is necessary to press ENTER when finished inputting data in those fields When Unicode Range or All Glyphs is selected for Text to the status bar will show the range of the characters that is currently being displayed If mouse cursor is pointed to one of the character the message will be changed to indicate what character the cursor is pointing to By clicking on a character one can also Zoom a character Options can be set to show grids around each or force the number of characters displayed across the screen to be These features are not available in User Text or File Text mode The default number of columns in a Unicode Range or All Glyphs drawing is fit as many as possible If this is too hard to then you can force number of columns to be However
Definition: README.txt:79
Demo.Action.copy
copy
Definition: Demo.java:75
Demo.chCopy
static void chCopy(Path src, Path dst)
Definition: Demo.java:677
methods
is injected On entry to all methods
Definition: README.txt:62
box
the text on screen will then be redrawn to draw the text just entered To hide the user text dialog box
Definition: README.txt:95
INTRODUCTION
A Simple Chat Server Example INTRODUCTION
Definition: README.txt:4
modes
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display modes
Definition: README.txt:43
result
the functions do not always return the right values for PostScript fonts There are still some bugs around the error handling Most of these problems will usually get fixed when some parameters are or the screen is refreshed Many fonts on Solaris fails to retrieve outlines and as the result
Definition: README.txt:145
RequestServicer
Definition: RequestServicer.java:51
text
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited text
Definition: README.txt:45
character
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an it is necessary to press ENTER when finished inputting data in those fields When Unicode Range or All Glyphs is selected for Text to the status bar will show the range of the characters that is currently being displayed If mouse cursor is pointed to one of the character the message will be changed to indicate what character the cursor is pointing to By clicking on a character one can also Zoom a character Options can be set to show grids around each character
Definition: README.txt:73
jobject
struct _jobject * jobject
Definition: jni.h:101
JVMTI_EVENT_GARBAGE_COLLECTION_FINISH
gctest This agent library can be used to track garbage collection events You can use this agent library as JVMTI_EVENT_GARBAGE_COLLECTION_FINISH
Definition: README.txt:47
Server
Definition: Server.java:56
columns
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an it is necessary to press ENTER when finished inputting data in those fields When Unicode Range or All Glyphs is selected for Text to the status bar will show the range of the characters that is currently being displayed If mouse cursor is pointed to one of the character the message will be changed to indicate what character the cursor is pointing to By clicking on a character one can also Zoom a character Options can be set to show grids around each or force the number of characters displayed across the screen to be These features are not available in User Text or File Text mode The default number of columns in a Unicode Range or All Glyphs drawing is fit as many as possible If this is too hard to then you can force number of columns to be this will not resize the window to fit all columns
Definition: README.txt:80
Demo.Action.setctime
setctime
Definition: Demo.java:108
Reply
Definition: Reply.java:51
include
About including and JRadioButtonMenuItem Metalworks is optimized to work with the Java look and such as that are specific to the Java look and feel Running then you should either specify the complete path to the java command or update your PATH environment variable as described in the installation instructions for the and many controls are non functional They are intended only to show how to construct the UI for such interfaces Things that do work in the Metalworks demo include
Definition: README.txt:52
effect
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an effect
Definition: README.txt:64
window
NetBeans Project Files for JDK Demos This directory contains project files for the NetBeans IDE for the all Java JDK to bring up the Java2D demo in do the download it from choose File Open Project In the popup window
Definition: README.txt:13
Demo.Action.extract
extract
Definition: Demo.java:137
API
What is this demo about This is script shell plugin for jconsole the monitoring and management client tool shipped with JRE This plugin adds Script Shell tab to jconsole This serves as a demo for jconsole plugin API(com.sun.tools.jconsole) as well as a demo for scripting API(javax.script) for the Java platform. Script console is an interactive read-eval-print interface that can be used used to execute advanced monitoring and management queries. By default
scripts
Sample scripts
Definition: README.txt:30
demo
FileChooserDemo demonstrates some of the capabilities of the JFileChooser object It brings up a window displaying several configuration controls that allow you to play with the JFileChooser options dynamically To run the FileChooserDemo demo
Definition: README.txt:11
MessageReader
Definition: MessageReader.java:47
socket
A Simple Chat Server Example the server takes input from a socket("user") and sends it to all other connected sockets("users") along with the provided name the user was asked for when first connecting. The server was written to demonstrate the asynchronous I/O API in JDK 7. The sample assumes the reader has some familiarity with the subject matter. SETUP
Demo.Action.zzmove
zzmove
Definition: Demo.java:91
Dispatcher
Definition: Dispatcher.java:52
it
is injected On any newarray type immediately following it
Definition: README.txt:57
Demo.Action.update
update
Definition: Demo.java:139
Demo.z2zcopy
static void z2zcopy(FileSystem src, FileSystem dst, String path)
Definition: Demo.java:461
prompt
where< script-file-path > is the path of your script file to load If you don t specify the file then the load function shows file dialog box to choose the script file to load How do I get help on script global functions If you use then there is a global function called help that prints one line help messages on global functions In script console prompt
Definition: README.txt:57
Demo.Action.vlist
vlist
Definition: Demo.java:126
following
NetBeans Project Files for JDK Demos This directory contains project files for the NetBeans IDE for the all Java JDK to bring up the Java2D demo in do the following
Definition: README.txt:8
displayed
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an it is necessary to press ENTER when finished inputting data in those fields When Unicode Range or All Glyphs is selected for Text to the status bar will show the range of the characters that is currently being displayed If mouse cursor is pointed to one of the character the message will be changed to indicate what character the cursor is pointing to By clicking on a character displayed
Definition: README.txt:72
uri
URI uri
Definition: README.txt:15
size
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including size
Definition: README.txt:42
ChatServer
Definition: ChatServer.java:54
Demo.update
static void update(FileSystem fs, String path)
Definition: Demo.java:426
BN
Definition: BN.java:51
jlong
__int64 jlong
Definition: jni_md.h:34
N1
Definition: N1.java:51
RequestHandler
Definition: RequestHandler.java:52
Implementation
README Design and Implementation
Definition: README.txt:38
heap
is injected All classes found via ClassFileLoadHook are injected with the exception of some system class methods< init > and finalize whose length is and system class methods with name< clinit > and also java lang Thread e g if heap
Definition: README.txt:82
used
the text on screen will then be redrawn to draw the text just entered To hide the user text dialog switch to different selection in Text to Use it is will be converted into the character that it maps to drawBytes will only work for characters in Unicode range by its method definition This program will warn when such text is being drawn in Range Text mode But since there is no way to detect this from User the warning will not be given even though wrong text seems to be drawn on screen when it contains any character beyond In the All Glyphs mode which displays all available glyphs for the current only drawGlyphVector is available as the draw method when Text File mode is used
Definition: README.txt:110
agentlib
Oracle and or its affiliates All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution Neither the name of Oracle nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE Header for agentlib
Definition: jvm.hprof.txt:33
Demo.Action.attrs
attrs
Definition: Demo.java:98
Demo.Action.mkdir
mkdir
Definition: Demo.java:113
server
in the editor and run the same with Tools Run menu You will see an alert box with the message world In addition to being a simple script editor scriptpad can be used to connect to a JMX MBean server("Tools->JMX Connect" menu). User can specify JMX hostname and port. After connecting
Text
the text on screen will then be redrawn to draw the text just entered To hide the user text dialog switch to different selection in Text to Use it is will be converted into the character that it maps to drawBytes will only work for characters in Unicode range by its method definition This program will warn when such text is being drawn in Range Text mode But since there is no way to detect this from User Text
Definition: README.txt:104
JEditorPane
About including JEditorPane
Definition: README.txt:5
CallSite
is injected On entry to all a invokestatic call to Tracker CallSite(cnum, mnum)
properly
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run properly
Definition: README.txt:32
site
NetBeans Project Files for JDK Demos This directory contains project files for the NetBeans IDE for the all Java JDK to bring up the Java2D demo in do the download it from choose File Open Project In the popup navigate to the JDK distribution and within that to the demo directory Press the Open Project Folder button That will open all of the e g Clean and Build Project and then Run Project but not of the projects can be run as applets as well Documentation and support for NetBeans is available at the NetBeans web site
Definition: README.txt:28
agent
versionCheck This agent library just makes some simple calls and checks the version of the interface being used to build the agent
Definition: README.txt:35
cpu
is injected All classes found via ClassFileLoadHook are injected with the exception of some system class methods< init > and finalize whose length is and system class methods with name< clinit > and also java lang Thread e g if the newarray and Object< init > method injections happen If cpu
Definition: README.txt:84
drawn
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an it is necessary to press ENTER when finished inputting data in those fields When Unicode Range or All Glyphs is selected for Text to the status bar will show the range of the characters that is currently being displayed If mouse cursor is pointed to one of the character drawn
Definition: README.txt:70
Demo.Action.create
create
Definition: Demo.java:145
JavaScript
where< script-file-path > is the path of your script file to load If you don t specify the file then the load function shows file dialog box to choose the script file to load How do I get help on script global functions If you use JavaScript(the default)
classes
mtrace This agent library can be used to track method call and return counts It uses the same java_crw_demo library used by HPROF to do BCI on all or selected classfiles loaded into the Virtual Machine It will print out a sorted list of the most heavily used classes(as determined by the number of method calls into the class) and also include the call and return counts for all methods that are called. You can use this agent library as follows
Definition: README.txt:37
Font2DTest
Font2DTest To run Font2DTest
Definition: README.txt:11
this
the functions do not always return the right values for PostScript fonts There are still some bugs around the error handling Most of these problems will usually get fixed when some parameters are or the screen is refreshed Many fonts on Solaris fails to retrieve outlines and as the they do not align within the grid properly These are mainly F3 and fonts that was returned by X server When showWindowWithoutWarningBanner AWTPermission is not the zoom window will look really bad because of the Applet warning label tacked at the bottom of the zoom window To remove this
Definition: README.txt:151
interesting
SampleTree demonstrates JTree features Each node of SampleTree has with each one drawn in a random font and color Each node is named after its font While the data isn t interesting
Definition: README.txt:3
themes
About including and JRadioButtonMenuItem Metalworks is optimized to work with the Java look and such as themes
Definition: README.txt:8
integers
is injected The hprof agent can map the two integers(cnum, mnum) to a method in a class. This is the BCI based "method entry" event. - On return from any method(any return opcode)
feature
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this feature
Definition: README.txt:59
Demo.Action.moveout
moveout
Definition: Demo.java:72
Demo.mkdirs
static void mkdirs(Path path)
Definition: Demo.java:543
demos
NetBeans Project Files for JDK Demos This directory contains project files for the NetBeans IDE for the all Java JDK demos(some of the demos involve C code;no NetBeans project files are provided for them at this time). For example
URLDumper
Definition: URLDumper.java:53
ChannelIOSecure
Definition: ChannelIOSecure.java:104
Demo
Definition: Demo.java:62
Demo.Action
Definition: Demo.java:64
style
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including style
Definition: README.txt:42
Demo.getZipFSProvider
static FileSystemProvider getZipFSProvider()
Definition: Demo.java:361
command
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this command
Definition: README.txt:26
B1
Definition: B1.java:50
injections
README Design and then moved to a package that didn t cause classload errors due to the security manager not liking the sun *package name detected that this class needs to be in com sun demo jvmti hprof The BCI code will call these static methods which will in with the additional current Thread the following bytecodes get injections
Definition: README.txt:53
ClientReader
Definition: ClientReader.java:47
t
MemoryMonitor demonstrates the use of the java lang management API in observing the memory usage of all memory pools consumed by the application This simple demo program queries the memory usage of each memory pool and plots the memory usage history graph To run the MemoryMonitor demo java jar< JDK_HOME > demo management MemoryMonitor MemoryMonitor jar These instructions assume that this installation s version of the java command is in your path If it isn t
Definition: README.txt:44
code
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source code
Definition: README.txt:19
com.sun
Metalworks
About Metalworks
Definition: README.txt:2
Demo.Action.copyin
copyin
Definition: Demo.java:78
fs
FileSystem fs
Definition: README.txt:9
Demo.extract
static void extract(FileSystem fs, String path)
Definition: Demo.java:442
screen
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the screen(or to be printed out). ----------------------------------------------------------------------- Tips on usage ----------------------------------------------------------------------- - The "Font" combobox will show a tick mark if some of the characters in selected unicode range can be displayed by this font. No tick is shown
canvas
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an it is necessary to press ENTER when finished inputting data in those fields When Unicode Range or All Glyphs is selected for Text to the status bar will show the range of the characters that is currently being displayed If mouse cursor is pointed to one of the character the message will be changed to indicate what character the cursor is pointing to By clicking on a character one can also Zoom a character Options can be set to show grids around each or force the number of characters displayed across the screen to be These features are not available in User Text or File Text mode The default number of columns in a Unicode Range or All Glyphs drawing is fit as many as possible If this is too hard to then you can force number of columns to be this will not resize the window to fit all so if the font size is too this will overflow the canvas(Unfortunately, I could not add horizontal space bar due to design restrictions) - If font size is too large to fit a character
Demo.Action.zzcopy
zzcopy
Definition: Demo.java:94
agents
enum @0 agents
ReturnSite
is injected The hprof agent can map the two a invokestatic call to Tracker ReturnSite(cnum, mnum)
JVMTI_EVENT_VM_DEATH
@ JVMTI_EVENT_VM_DEATH
Definition: jvmti.h:395
JVMTI_EVENT_OBJECT_FREE
@ JVMTI_EVENT_OBJECT_FREE
Definition: jvmti.h:423
Demo.Action.tlist
tlist
Definition: Demo.java:123
all
NetBeans Project Files for JDK Demos This directory contains project files for the NetBeans IDE for the all Java JDK to bring up the Java2D demo in do the download it from choose File Open Project In the popup navigate to the JDK distribution and within that to the demo directory Press the Open Project Folder button That will open all of the e g Clean and Build Project and then Run Project but not all
Definition: README.txt:22
Demo.Action.rename
rename
Definition: Demo.java:65
IterateThroughHeap
heapViewer This agent library demonstrates how to get an easy view of the heap in terms of total object count and space used It uses and IterateThroughHeap() to count up all the objects of all the current loaded classes. The heap dump will happen at the event JVMTI_EVENT_VM_DEATH
here
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an it is necessary to press ENTER when finished inputting data in those fields When Unicode Range or All Glyphs is selected for Text to the status bar will show the range of the characters that is currently being displayed If mouse cursor is pointed to one of the character the message will be changed to indicate what character the cursor is pointing to By clicking on a character one can also Zoom a character Options can be set to show grids around each or force the number of characters displayed across the screen to be These features are not available in User Text or File Text mode The default number of columns in a Unicode Range or All Glyphs drawing is fit as many as possible If this is too hard to then you can force number of columns to be this will not resize the window to fit all so if the font size is too this will overflow the then a message will inform that smaller font size or larger canvas size is needed Custom Unicode Range can be displayed by selecting Custom at the bottom of the Unicode Range menu This will bring up a dialog box to specify the starting and ending index of the unicode characters to be drawn To enter a customized select User Text from Text to Use menu A dialog box with a text area will come up Enter any text here
Definition: README.txt:93
currentThread
is injected All classes found via ClassFileLoadHook are injected with the exception of some system class methods< init > and finalize whose length is and system class methods with name< clinit > and also java lang Thread currentThread() which is used in the class Tracker(preventing nasty recursion issue). System classes are currently defined as any class seen by the ClassFileLoadHook prior to VM_INIT. This does mean that objects created in the system classes inside< clinit > might not get tracked initially. See the java_crw_demo source and documentation for more info. The injections are based on what the hprof options are requesting
NetBeans
NetBeans Project Files for JDK Demos This directory contains project files for the NetBeans IDE for the all Java JDK to bring up the Java2D demo in NetBeans
Definition: README.txt:6
addition
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In addition
Definition: README.txt:46
menu
the text on screen will then be redrawn to draw the text just entered To hide the user text dialog switch to different selection in Text to Use menu(Closing the dialog box will not work...) If a escape sequence of form \uXXXX is entered
functions
gctest This agent library can be used to track garbage collection events You can use this agent library as and JVMTI_EVENT_OBJECT_FREE all have limitations as to what can be called directly inside the agent callback functions(e.g. no JNI calls are allowed, and limited interface calls can be made). However
URL
VerboseGC demonstrates the use of the java lang management API to print the garbage collection statistics and memory usage remotely by connecting to a JMX agent with a JMX service URL
Definition: README.txt:28
ObjectInit
README Design and then moved to a package that didn t cause classload errors due to the security manager not liking the sun *package name detected that this class needs to be in com sun demo jvmti hprof The BCI code will call these static methods which will in with the additional current Thread the following bytecodes get a invokestatic call to Tracker ObjectInit(this)
client
A Simple Chat Server Example the server takes input from a it handles the startup and handles incoming connections on the listening sockets It keeps a list of connected client and provides methods for sending a message to them Client represents a connected it provides methods for reading writing from to the underlying socket It also contains a buffer of input read from the user DataReader provides the interface of the two states a user can be in Waiting for a it sends the user a string and waits for a response before changing the state to MessageReader MessageReader is the main state for a client
Definition: README.txt:57
class
About including and JRadioButtonMenuItem Metalworks is optimized to work with the Java look and such as that are specific to the Java look and feel Running then you should either specify the complete path to the java command or update your PATH environment variable as described in the installation instructions for the and many controls are non functional They are intended only to show how to construct the UI for such interfaces Things that do work in the Metalworks demo but also the sizes of many controls Also included with this demo is the PropertiesMetalTheme class
Definition: README.txt:54
Demo.Action.copyin_attrs
copyin_attrs
Definition: Demo.java:82
a
Xmixed mixed mode execution(default) -Xint interpreted mode execution only -Xbootclasspath set search path for bootstrap classes and resources Xbootclasspath a
Definition: Xusage.txt:1
steps
Sample you need an application to monitor You can use memory bat or memory sh in the current directory to start an application that will be monitored After that please follow these steps
Definition: README.txt:44
BP
Definition: BP.java:51
update
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an it is necessary to press ENTER when finished inputting data in those fields When Unicode Range or All Glyphs is selected for Text to the status bar will show the range of the characters that is currently being displayed If mouse cursor is pointed to one of the character the message will be changed to indicate what character the cursor is pointing to By clicking on a character one can also Zoom a character Options can be set to show grids around each or force the number of characters displayed across the screen to be These features are not available in User Text or File Text mode The default number of columns in a Unicode Range or All Glyphs drawing is fit as many as possible If this is too hard to then you can force number of columns to be this will not resize the window to fit all so if the font size is too this will overflow the then a message will inform that smaller font size or larger canvas size is needed Custom Unicode Range can be displayed by selecting Custom at the bottom of the Unicode Range menu This will bring up a dialog box to specify the starting and ending index of the unicode characters to be drawn To enter a customized select User Text from Text to Use menu A dialog box with a text area will come up Enter any text and then press update
Definition: README.txt:94
JFileChooser
About including JFileChooser
Definition: README.txt:5
JInternalFrame
About including JInternalFrame
Definition: README.txt:5
Demo.streamCopy
static void streamCopy(Path src, Path dst)
Definition: Demo.java:697
read
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an it is necessary to press ENTER when finished inputting data in those fields When Unicode Range or All Glyphs is selected for Text to the status bar will show the range of the characters that is currently being displayed If mouse cursor is pointed to one of the character the message will be changed to indicate what character the cursor is pointing to By clicking on a character one can also Zoom a character Options can be set to show grids around each or force the number of characters displayed across the screen to be These features are not available in User Text or File Text mode The default number of columns in a Unicode Range or All Glyphs drawing is fit as many as possible If this is too hard to read
Definition: README.txt:78
JVMTI_EVENT_GARBAGE_COLLECTION_START
@ JVMTI_EVENT_GARBAGE_COLLECTION_START
Definition: jvmti.h:421
Demo.Action.setmtime
setmtime
Definition: Demo.java:104
features
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all features
Definition: README.txt:34
found
Oracle and or its affiliates All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution Neither the name of Oracle nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE Header for and is subject to change without notice This file contains the following types of the frames in which GC roots were found
Definition: jvm.hprof.txt:45
changed
the functions do not always return the right values for PostScript fonts There are still some bugs around the error handling Most of these problems will usually get fixed when some parameters are changed
Definition: README.txt:142
GetLoadedClasses
heapViewer This agent library demonstrates how to get an easy view of the heap in terms of total object count and space used It uses GetLoadedClasses()
Demo.Action.add
add
Definition: Demo.java:143
JVMTI_EVENT_DATA_DUMP_REQUEST
@ JVMTI_EVENT_DATA_DUMP_REQUEST
Definition: jvmti.h:415
children
SampleTree demonstrates JTree features Each node of SampleTree has children
Definition: README.txt:2
SetTag
heapViewer This agent library demonstrates how to get an easy view of the heap in terms of total object count and space used It uses SetTag()
JTabbedPane
About including JTabbedPane
Definition: README.txt:5
com
turn
README Design and then moved to a package that didn t cause classload errors due to the security manager not liking the sun *package name detected that this class needs to be in com sun demo jvmti hprof The BCI code will call these static methods which will in turn(if engaged) call matching native methods in the hprof library
argument
README Design and then moved to a package that didn t cause classload errors due to the security manager not liking the sun *package name detected that this class needs to be in com sun demo jvmti hprof The BCI code will call these static methods which will in with the additional current Thread argument(Thread.currentThread()). Doing the currentThread call on the Java side was necessary due to the difficulty of getting the current thread while inside one of these Tracker native methods. This class lives in rt.jar. *Byte Code Instrumentation(BCI) Using the ClassFileLoadHook feature and a C language implementation of a byte code injection transformer
follows
gctest This agent library can be used to track garbage collection events You can use this agent library as follows
Definition: README.txt:46
Demo.fchCopy
static void fchCopy(Path src, Path dst)
Definition: Demo.java:657
script
Scriptpad Sample *Introduction Scriptpad is a notepad like editor to open edit save and run script(JavaScript) files. This sample demonstrates the use of javax.script(JSR-223) API and JavaScript engine that is bundled with JDK 6. Scriptpad sample demonstrates how to use Javascript to use Java classes and objects to perform various tasks such as to modify
follows
Definition: README.txt:37
in
===================================================================Known Problems:- When a PostScript font is used, the characters may extend beyond the enclosing grid or zoom rectangle. This is due to the problem with FontMetrics.getMaxAscent() and getMaxDescent() functions in
Definition: README.txt:137
Demo.Action.movein
movein
Definition: Demo.java:68
ChannelIO
Definition: ChannelIO.java:56
http
NetBeans Project Files for JDK Demos This directory contains project files for the NetBeans IDE for the all Java JDK to bring up the Java2D demo in do the download it from http
Definition: README.txt:12
Demo.Action.list
list
Definition: Demo.java:119
Demo.Action.twalk
twalk
Definition: Demo.java:134
Demo.Action.copyout
copyout
Definition: Demo.java:86
vendors
The four examples in this directory show how to use some of the features of the JTable component which has a TextArea that can be used as an editor for an SQL expression Pressing the Fetch button sends the expression to the database The results are displayed in the JTable underneath the text area To run TableExample and you need to find a driver for your database and set the environment variable JDBCHOME to a directory where the driver is installed See the following URL for a list of JDBC drivers provided by third party vendors
Definition: README.txt:31
parts
FullThreadDump demonstrates the use of the java lang management API to print the full thread dump JDK defines a new API to dump the information about monitors and java util concurrent ownable synchronizers This demo also illustrates how to monitor JDK and JDK VMs with two versions of APIs It contains two parts
Definition: README.txt:49
Use
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an it is necessary to press ENTER when finished inputting data in those fields When Unicode Range or All Glyphs is selected for Text to Use
Definition: README.txt:67
Demo.Action.walk
walk
Definition: Demo.java:130
DataReader
Definition: DataReader.java:43
GUI
JTop monitors the CPU usage of all threads in a remote application which has remote management enabled JTop demonstrates the use of the java lang management API to obtain the CPU consumption for each thread JTop is also a JConsole Plugin See below for details JTop Standalone GUI
Definition: README.txt:9
user
A Simple Chat Server Example the server takes input from a it handles the startup and handles incoming connections on the listening sockets It keeps a list of connected client and provides methods for sending a message to them Client represents a connected user
Definition: README.txt:44
feel
About including and JRadioButtonMenuItem Metalworks is optimized to work with the Java look and feel(codenamed "Metal") and shows use of several features
env
or Map< String,?> env
Definition: README.txt:14
objects
is injected All classes found via ClassFileLoadHook are injected with the exception of some system class methods< init > and finalize whose length is and system class methods with name< clinit > and also java lang Thread e g if the newarray and Object< init > method injections happen If all methods get their entries and returns tracked Options like or an index into the object table inside the hprof code Depending on whether these ObjectIndex s might represent unique objects
Definition: README.txt:93
Demo.Action.rmdirs
rmdirs
Definition: Demo.java:117
Request
Definition: Request.java:55
Client
Definition: Client.java:59
time
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a time
Definition: README.txt:44
opcode
is injected On any newarray type opcode
Definition: README.txt:57
Demo.Action.prof
prof
Definition: Demo.java:152
Demo.Action.setatime
setatime
Definition: Demo.java:107
name
A Simple Chat Server Example the server takes input from a it handles the startup and handles incoming connections on the listening sockets It keeps a list of connected client and provides methods for sending a message to them Client represents a connected it provides methods for reading writing from to the underlying socket It also contains a buffer of input read from the user DataReader provides the interface of the two states a user can be in Waiting for a name(and not receiving any messages while doing so, implemented by NameReader) and waiting for messages from the user(implemented by MessageReader). ClientReader contains the "main loop" for a connected client. NameReader is the initial state for a new client
Demo.z2zmove
static void z2zmove(FileSystem src, FileSystem dst, String path)
Definition: Demo.java:486
big
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including and rendering hints The user can select from multiple display such as one Unicode range at a all glyphs of a particular user edited or text loaded from a file In the user can control which method will be used to render the text to the if none of the characters can be displayed A tooltip is shown with this information This indication is available only if Unicode Range is selected in Text to use combobox This feature is enabled by default For disabling this use command line flag disablecandisplaycheck or dcdc java jar Font2DTest jar dcdc For the Font Size field to have an it is necessary to press ENTER when finished inputting data in those fields When Unicode Range or All Glyphs is selected for Text to the status bar will show the range of the characters that is currently being displayed If mouse cursor is pointed to one of the character the message will be changed to indicate what character the cursor is pointing to By clicking on a character one can also Zoom a character Options can be set to show grids around each or force the number of characters displayed across the screen to be These features are not available in User Text or File Text mode The default number of columns in a Unicode Range or All Glyphs drawing is fit as many as possible If this is too hard to then you can force number of columns to be this will not resize the window to fit all so if the font size is too big
Definition: README.txt:80
NameReader
Definition: NameReader.java:50
Demo.Action.copyout_attrs
copyout_attrs
Definition: Demo.java:89
Demo.Action.mkdirs
mkdirs
Definition: Demo.java:115
TableExample
The four examples in this directory show how to use some of the features of the JTable component TableExample
Definition: README.txt:19
NewArray
is injected On any newarray type immediately following the array object is duplicated on the stack and an invokestatic call to Tracker NewArray(obj)