Java Code Examples for java.io.File.getClass()

The following are Jave code examples for showing how to use getClass() of the java.io.File class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: ProvidedExtensionsTest.java   View Source Code Vote up 5 votes
@Override
public ProvidedExtensions.IOHandler getMoveHandler(final File from, final File to) {
    to.getClass();
    implsMoveCalls++;
    return (!isImplsMoveRetVal() || to == null) ? null : new ProvidedExtensions.IOHandler(){
        public void handle() throws IOException {
            moveImplCalls++;
            if (to.exists()) {
                throw new IOException();
            }
            assertTrue(from.exists());
            assertFalse(to.exists());
            
            assertFalse(from.equals(to));
            if (from.isDirectory()) {
                from.renameTo(to);
            } else {
                InputStream inputStream = new FileInputStream(from);
                OutputStream outputStream = new FileOutputStream(to);
                try {
                    FileUtil.copy(inputStream, outputStream);
                } finally {
                    if (inputStream != null) inputStream.close();
                    if (outputStream != null) outputStream.close();
                }
                to.setLastModified(from.lastModified());
                assertTrue(from.delete());
            }
            
            assertFalse(from.exists());
            assertTrue(to.exists());
        }
    };
}
 
Example 2
Project: incubator-netbeans   File: ProvidedExtensionsTest.java   View Source Code Vote up 5 votes
@Override
public ProvidedExtensions.IOHandler getCopyHandler(final File from, final File to) {
    to.getClass();
    if (from.isDirectory()) {
        return null;
    }
    implsCopyCalls++;
    return (!isImplsCopyRetVal() || to == null) ? null : new ProvidedExtensions.IOHandler(){
        @Override
        public void handle() throws IOException {
            copyImplCalls++;
            if (to.exists()) {
                throw new IOException();
            }
            assertTrue(from.exists());
            assertFalse(to.exists());
            
            assertFalse(from.equals(to));
            InputStream inputStream = new FileInputStream(from);
            OutputStream outputStream = new FileOutputStream(to);
            try {
                FileUtil.copy(inputStream, outputStream);
            } finally {
                if (inputStream != null) inputStream.close();
                if (outputStream != null) outputStream.close();
            }
            assertTrue(from.exists());
            assertTrue(to.exists());
        }
    };
}
 
Example 3
Project: incubator-netbeans   File: FileUtil.java   View Source Code Vote up 5 votes
static String toDebugString(File file) {
    if (file == null) {
        return "NULL-ref"; // NOI18N
    } else {
        return file.getPath() + "(" + file.getClass() + ")"; // NOI18N
    }
}
 
Example 4
Project: incubator-netbeans   File: ProvidedExtensionsTest.java   View Source Code Vote up 4 votes
public void beforeMove(FileObject fo, File to) {
    to.getClass();
    assertLock();
    beforeMoveCalls++;
}
 
Example 5
Project: incubator-netbeans   File: ProvidedExtensionsTest.java   View Source Code Vote up 4 votes
public void moveSuccess(FileObject fo, File to) {
    to.getClass();
    assertLock();
    moveSuccessCalls++;
}
 
Example 6
Project: incubator-netbeans   File: ProvidedExtensionsTest.java   View Source Code Vote up 4 votes
public void moveFailure(FileObject fo, File to) {
    to.getClass();
    assertLock();
    moveFailureCalls++;
}
 
Example 7
Project: incubator-netbeans   File: ProvidedExtensionsTest.java   View Source Code Vote up 4 votes
public void beforeCopy(FileObject fo, File to) {
    to.getClass();
    assertLock();
    beforeCopyCalls++;
}
 
Example 8
Project: incubator-netbeans   File: ProvidedExtensionsTest.java   View Source Code Vote up 4 votes
public void copySuccess(FileObject fo, File to) {
    to.getClass();
    assertLock();
    copySuccessCalls++;
}
 
Example 9
Project: incubator-netbeans   File: ProvidedExtensionsTest.java   View Source Code Vote up 4 votes
public void copyFailure(FileObject fo, File to) {
    to.getClass();
    assertLock();
    copyFailureCalls++;
}
 
Example 10
Project: Atomic   File: B.java   View Source Code Vote up 4 votes
public B(A a, File file) {
    super(a, file.getClass());
    this.t = file;
}