Java Code Examples for javax.microedition.io.file.FileConnection#setHidden()

The following examples show how to use javax.microedition.io.file.FileConnection#setHidden() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a hidden file
 */
public void test0001() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating file: " + conn.getURL());
			ensureFileExists(conn);
			
			addOperationDesc("Setting file as hidden");
			conn.setHidden(true);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden);
			
			passed = isHidden==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isHidden() on a hidden file", passed);
}
 
Example 2
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a non-hidden file
 */
public void test0002() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating file: " + conn.getURL());
			ensureFileExists(conn);
			
			addOperationDesc("Setting file as non-hidden");
			conn.setHidden(false);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden);
			
			passed = isHidden==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isHidden() on a non-hidden file", passed);
}
 
Example 3
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a hidden directory
 */
public void test0003() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating directory: " + conn.getURL());
			ensureDirExists(conn);
			
			addOperationDesc("Setting directory as hidden");
			conn.setHidden(true);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden);
			
			passed = isHidden==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isHidden() on a hidden directory", passed);
}
 
Example 4
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a non-hidden directory
 */
public void test0004() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating directory: " + conn.getURL());
			ensureDirExists(conn);
			
			addOperationDesc("Setting directory as non-hidden");
			conn.setHidden(false);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden);
			
			passed = isHidden==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isHidden() on a non-hidden directory", passed);
}
 
Example 5
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a file (hidden attribute is NOT supported by filesystem)
 */
public void test0005() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating file: " + conn.getURL());
			ensureFileExists(conn);
			
			addOperationDesc("Setting file as hidden");
			conn.setHidden(true);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden + " (should have no effect)");
			
			passed = isHidden==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isHidden() on a file (hidden attribute is NOT supported by filesystem)", passed);
}
 
Example 6
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a directory (hidden attribute is NOT supported by filesystem)
 */
public void test0006() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating directory: " + conn.getURL());
			ensureDirExists(conn);
			
			addOperationDesc("Setting directory as hidden");
			conn.setHidden(true);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden + " (should have no effect)");
			
			passed = isHidden==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isHidden() on a file (hidden attribute is NOT supported by filesystem)", passed);
}