当前位置: 首页>>代码示例>>Java>>正文


Java FileConnection.canWrite方法代码示例

本文整理汇总了Java中javax.microedition.io.file.FileConnection.canWrite方法的典型用法代码示例。如果您正苦于以下问题:Java FileConnection.canWrite方法的具体用法?Java FileConnection.canWrite怎么用?Java FileConnection.canWrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.microedition.io.file.FileConnection的用法示例。


在下文中一共展示了FileConnection.canWrite方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test0001

import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
 * Tests canWrite() on a writable 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 writable");
			conn.setWritable(true);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests canWrite() on a writable file", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:29,代码来源:CanWrite.java

示例2: test0002

import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
 * Tests canWrite() on a non-writable 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-writable");
			conn.setWritable(false);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests canWrite() on a non-writable file", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:29,代码来源:CanWrite.java

示例3: test0003

import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
 * Tests canWrite() on a writable 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 writable");
			conn.setWritable(true);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests canWrite() on a writable directory", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:29,代码来源:CanWrite.java

示例4: test0004

import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
 * Tests canWrite() on a non-writable 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-writable");
			conn.setWritable(false);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests canWrite() on a on-writable directory", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:29,代码来源:CanWrite.java

示例5: test0005

import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
 * Tests canWrite() on a file (writable 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 non-writable");
			conn.setWritable(false);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests canWrite() on a file (writable attribute is NOT supported by filesystem)", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:29,代码来源:CanWrite.java

示例6: test0006

import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
 * Tests canWrite() on a directory (writable 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 non-writable");
			conn.setWritable(false);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests canWrite() on a directory (writable attribute is NOT supported by filesystem)", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:29,代码来源:CanWrite.java

示例7: test0009

import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
 * Tests canWrite() in Connector.READ mode
 */
public void test0009() {
	boolean passed = false;
	try {	
		addOperationDesc("Opening connection in READ mode");
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ);
		try {
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() call returned " + canWrite);
			
			passed = true;								
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}
	
	assertTrueWithLog("Tests canWrite() in Connector.READ mode", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:24,代码来源:CanWrite.java

示例8: test0010

import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
 * Tests canWrite() on a non-existent file
 */
public void test0010() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting file: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("canWrite() returns false for a non-existent file", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:26,代码来源:CanWrite.java

示例9: test0011

import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
 * Tests canWrite() on a non-existent file (writable attribute is NOT supported by filesystem)
 */
public void test0011() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting file: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("canWrite() returns false for a non-existent file (writable attribute is NOT supported by filesystem)", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:26,代码来源:CanWrite.java

示例10: test0012

import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
 * Tests canWrite() on a non-existent directory
 */
public void test0012() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting directory: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("canWrite() returns false for a non-existent directory", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:26,代码来源:CanWrite.java

示例11: test0013

import javax.microedition.io.file.FileConnection; //导入方法依赖的package包/类
/**
 * Tests canWrite() on a non-existent directory (writable attribute is NOT supported by filesystem)
 */
public void test0013() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting directory: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("canWrite() returns false for a non-existent directory (writable attribute is NOT supported by filesystem)", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:26,代码来源:CanWrite.java


注:本文中的javax.microedition.io.file.FileConnection.canWrite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。