本文整理匯總了Java中java.io.FileOutputStream.getFD方法的典型用法代碼示例。如果您正苦於以下問題:Java FileOutputStream.getFD方法的具體用法?Java FileOutputStream.getFD怎麽用?Java FileOutputStream.getFD使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.io.FileOutputStream
的用法示例。
在下文中一共展示了FileOutputStream.getFD方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: transfer
import java.io.FileOutputStream; //導入方法依賴的package包/類
static public long transfer(long position, long count, FileInputStream src, FileOutputStream dst) throws IOException {
FileChannel srcChannel = src.getChannel();
FileChannel dstChannel = dst.getChannel();
if (!srcChannel.isOpen()) {
throw new ClosedChannelException();
}
if (!dstChannel.isOpen()) {
throw new ClosedChannelException();
}
if (position < 0 || count < 0) {
throw new IllegalArgumentException("position=" + position + " count=" + count);
}
if (count == 0 || position >= srcChannel.size()) {
return 0;
}
count = Math.min(count, srcChannel.size() - position);
FileDescriptor inFd = src.getFD();
FileDescriptor outFd = dst.getFD();
long rc = 0;
rc = native_sendfile_64(outFd, inFd, position, count);
return rc;
}
示例2: openFile
import java.io.FileOutputStream; //導入方法依賴的package包/類
protected void openFile() throws HsqlException {
try {
FileOutputStream fos = new FileOutputStream(outFile, true);
outDescriptor = fos.getFD();
fileStreamOut = new DeflaterOutputStream(fos,
new Deflater(Deflater.DEFAULT_COMPRESSION), bufferSize);
} catch (IOException e) {
throw Trace.error(Trace.FILE_IO_ERROR, Trace.Message_Pair,
new Object[] {
e.getMessage(), outFile
});
}
}
示例3: openFile
import java.io.FileOutputStream; //導入方法依賴的package包/類
/**
* File is opened in append mode although in current usage the file
* never pre-exists
*/
protected void openFile() throws HsqlException {
try {
FileOutputStream fos = new FileOutputStream(outFile, true);
outDescriptor = fos.getFD();
fileStreamOut = new BufferedOutputStream(fos, 2 << 12);
} catch (IOException e) {
throw Trace.error(Trace.FILE_IO_ERROR, Trace.Message_Pair,
new Object[] {
e.getMessage(), outFile
});
}
}
示例4: write
import java.io.FileOutputStream; //導入方法依賴的package包/類
/**
* Write the data to the file indicate by fileName. The file is created if
* it doesn't exists.
*/
public static void write(Activity activity, String data, String fileName) throws IOException {
FileOutputStream fo = activity.openFileOutput(fileName, 0);
BufferedWriter bf = new BufferedWriter(new FileWriter(fo.getFD()));
bf.write(data);
bf.flush();
bf.close();
}
示例5: FileSync
import java.io.FileOutputStream; //導入方法依賴的package包/類
FileSync(FileOutputStream os) throws IOException {
outDescriptor = os.getFD();
}
示例6: FileSync
import java.io.FileOutputStream; //導入方法依賴的package包/類
FileSync(FileOutputStream os) throws java.io.IOException {
outDescriptor = os.getFD();
}