本文整理汇总了Java中javax.microedition.io.file.FileConnection.setHidden方法的典型用法代码示例。如果您正苦于以下问题:Java FileConnection.setHidden方法的具体用法?Java FileConnection.setHidden怎么用?Java FileConnection.setHidden使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.io.file.FileConnection
的用法示例。
在下文中一共展示了FileConnection.setHidden方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test0001
import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
* 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);
}
示例2: test0002
import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
* 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);
}
示例3: test0003
import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
* 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);
}
示例4: test0004
import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
* 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);
}
示例5: test0005
import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
* 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);
}
示例6: test0006
import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
* 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);
}