List of usage examples for java.io File File
public File(URI uri)
From source file:Main.java
public static void main(String[] args) throws Exception { BufferedImage img = colorImage(ImageIO.read(new File("NWvnS.png"))); ImageIO.write(img, "png", new File("Test.png")); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JarFile jarfile = new JarFile(new File("filename.jar"), true); Manifest manifest = jarfile.getManifest(); Attributes attrs = (Attributes) manifest.getMainAttributes(); for (Iterator it = attrs.keySet().iterator(); it.hasNext();) { Attributes.Name attrName = (Attributes.Name) it.next(); String attrValue = attrs.getValue(attrName); }/* w ww . j a va 2s . c o m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { copy(new File("src.dat"), new File("dst.dat")); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JarFile jarfile = new JarFile(new File("filename.jar"), true, JarFile.OPEN_READ); Manifest manifest = jarfile.getManifest(); Attributes attrs = (Attributes) manifest.getMainAttributes(); for (Iterator it = attrs.keySet().iterator(); it.hasNext();) { Attributes.Name attrName = (Attributes.Name) it.next(); String attrValue = attrs.getValue(attrName); }/*from w ww . jav a 2 s . c o m*/ }
From source file:Main.java
public static void main(String args[]) throws IOException { JarFile jarFile = new JarFile(new File("c:/abc/yourJarFileName.jar")); Enumeration<JarEntry> e = jarFile.entries(); while (e.hasMoreElements()) { process(e.nextElement());//from w ww . j av a2 s. c o m } jarFile.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { File aFile = new File("primes.txt"); FileInputStream inFile = new FileInputStream(aFile); FileChannel inChannel = inFile.getChannel(); ByteBuffer buf = ByteBuffer.allocateDirect(1024); buf.position(buf.limit());/*from w ww.j a v a 2s .c om*/ while (true) { if (buf.remaining() < 8) { if (inChannel.read(buf.compact()) == -1) { break; } buf.flip(); } int strLength = (int) buf.getDouble(); if (buf.remaining() < 2 * strLength) { if (inChannel.read(buf.compact()) == -1) { break; } buf.flip(); } byte[] strChars = new byte[2 * strLength]; buf.get(strChars); if (buf.remaining() < 8) { if (inChannel.read(buf.compact()) == -1) { break; } buf.flip(); } System.out.println(strLength); System.out.println(ByteBuffer.wrap(strChars).asCharBuffer()); System.out.println(buf.getLong()); } inFile.close(); }
From source file:Main.java
public static void main(String args[]) throws Exception { BufferedImage img1 = ImageIO.read(new File("c:/Java_Dev/1.png")); BufferedImage img2 = ImageIO.read(new File("c:/Java_Dev/2.png")); BufferedImage joinedImg = joinBufferedImage(img1, img2); ImageIO.write(joinedImg, "png", new File("c:/Java_Dev/joined.png")); }
From source file:Main.java
public static void main(String args[]) throws Exception { String s = "<xmltag atr=value>tag data</xmltag>"; FileWriter fr = new FileWriter(new File("a.txt")); Writer br = new BufferedWriter(fr); br.write(s);//from ww w.j av a 2 s . c o m br.close(); }
From source file:MainClass.java
public static void main(String[] args) throws IOException { FileChannel fc = new FileInputStream(new File("temp.tmp")).getChannel(); IntBuffer ib = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()).asIntBuffer(); while (ib.hasRemaining()) ib.get();//from w w w . j a v a 2 s.co m fc.close(); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JFileChooser chooser = new JFileChooser(); File f = new File(new File("filename.txt").getCanonicalPath()); chooser.setFileSystemView(FileSystemView.getFileSystemView()); chooser.showDialog(new JFrame(""), null); File curFile = chooser.getSelectedFile(); }