use crate::{
java::{lang::Comparable, nio::file::Path},
JObjNew, JObjRef, JType,
};
use droid_wrap_derive::{java_class, java_constructor, java_field, java_interface, java_method};
#[java_class(name = "java/io/File", extends = super::lang::Object)]
pub struct File;
impl File {
pub const CANONICALIZE_PARENT_OF_ROOT_DIR: u64 = 312399441;
#[java_constructor]
pub fn new(pathname: String) -> Result<Self, <Self as JType>::Error> {}
#[java_constructor]
pub fn new_with_parent(
parent: Option<String>,
child: String,
) -> Result<Self, <Self as JType>::Error> {
}
#[java_constructor]
pub fn new_with_parent_file(
parent: Option<Self>,
child: String,
) -> Result<Self, <Self as JType>::Error> {
}
#[java_field]
pub fn get_separator_char() -> char {}
#[java_field]
pub fn get_separator() -> String {}
#[java_field]
pub fn get_path_separator_char() -> char {}
#[java_field]
pub fn get_path_separator() -> String {}
#[java_method]
pub fn get_name(&self) -> String {}
#[java_method]
pub fn get_parent(&self) -> Option<String> {}
#[java_method]
pub fn get_parent_file(&self) -> Option<Self> {}
#[java_method]
pub fn is_absolute(&self) -> bool {}
#[java_method]
pub fn get_absolute_path(&self) -> String {}
#[java_method]
pub fn get_canonical_path(&self) -> Result<String, <Self as JType>::Error> {}
#[java_method]
pub fn get_canonical_file(&self) -> Result<Self, <Self as JType>::Error> {}
#[java_method]
pub fn can_read(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn can_write(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn exists(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn is_directory(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn is_file(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn is_hidden(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn last_modified(&self) -> Result<u64, <Self as JType>::Error> {}
#[java_method]
pub fn length(&self) -> Result<u64, <Self as JType>::Error> {}
#[java_method]
pub fn create_new_file(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn delete(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn delete_on_exit(&self) -> Result<(), <Self as JType>::Error> {}
#[java_method]
pub fn mkdir(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn mkdirs(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn rename_to(&self, dest: Self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn set_last_modified(&self, time: u64) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn set_read_only(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn set_writable(
&self,
writable: bool,
owner_only: bool,
) -> Result<bool, <Self as JType>::Error> {
}
#[java_method(overload = setWritable)]
pub fn set_writable_convenience(&self, writable: bool) -> Result<bool, <Self as JType>::Error> {
}
#[java_method]
pub fn set_readable(
&self,
readable: bool,
owner_only: bool,
) -> Result<bool, <Self as JType>::Error> {
}
#[java_method(overload = setReadable)]
pub fn set_readable_convenience(&self, readable: bool) -> Result<bool, <Self as JType>::Error> {
}
#[java_method]
pub fn set_executable(
&self,
executable: bool,
owner_only: bool,
) -> Result<bool, <Self as JType>::Error> {
}
#[java_method(overload = setExecutable)]
pub fn set_executable_convenience(
&self,
executable: bool,
) -> Result<bool, <Self as JType>::Error> {
}
#[java_method]
pub fn can_execute(&self) -> Result<bool, <Self as JType>::Error> {}
#[java_method]
pub fn get_total_space(&self) -> Result<u64, <Self as JType>::Error> {}
#[java_method]
pub fn get_free_space(&self) -> Result<u64, <Self as JType>::Error> {}
#[java_method]
pub fn get_usable_space(&self) -> Result<u64, <Self as JType>::Error> {}
#[java_method]
pub fn create_temp_file(
prefix: String,
suffix: Option<String>,
directory: Option<Self>,
) -> Result<Self, <Self as JType>::Error> {
}
#[java_method(overload = createTempFile)]
pub fn create_temp_file_default(
prefix: String,
suffix: Option<String>,
) -> Result<Self, <Self as JType>::Error> {
}
#[java_method]
pub fn to_path<P: Path>(&self) -> Result<P, <Self as JType>::Error> {}
}
impl Comparable<File> for File {
#[java_method]
fn compare_to(&self, o: &File) -> Result<i32, <Self as JType>::Error> {}
}
#[java_interface(name = "java/io/Serializable")]
pub trait Serializable {}
#[cfg(feature = "test_java_io")]
pub fn test() {
assert_eq!('/', File::get_separator_char());
assert_eq!(String::from("/"), File::get_separator());
assert_eq!(':', File::get_path_separator_char());
assert_eq!(String::from(":"), File::get_path_separator());
let file = File::new("/data".to_string()).unwrap();
let file = File::new_with_parent(Some(file.to_string()), "/local".to_string()).unwrap();
let file = File::new_with_parent_file(Some(file), "/tmp".to_string()).unwrap();
assert_eq!("tmp", file.get_name());
assert_eq!(Some("/data/local".to_string()), file.get_parent());
assert!(file.get_parent_file().is_some());
assert!(file.is_absolute());
assert_eq!("/data/local/tmp", file.get_absolute_path());
assert!(file.get_canonical_path().is_ok());
assert!(file.get_canonical_file().is_ok());
assert!(file.can_read().is_ok());
assert!(file.can_write().is_ok());
assert!(file.exists().is_ok());
assert!(file.is_directory().is_ok());
assert!(file.is_file().is_ok());
assert!(file.is_hidden().is_ok());
assert!(file.last_modified().is_ok());
assert!(file.length().is_ok());
assert!(file.create_new_file().is_ok());
assert!(file.delete().is_ok());
assert!(file.delete_on_exit().is_ok());
assert!(file.mkdir().is_ok());
assert!(file.mkdirs().is_ok());
assert!(file
.rename_to(File::new("/data/local/tmp".to_string()).unwrap())
.is_ok());
assert!(file.set_last_modified(0).is_ok());
assert!(file.set_read_only().is_ok());
assert!(file.set_writable(false, false).is_ok());
assert!(file.set_writable_convenience(false).is_ok());
assert!(file.set_readable(false, false).is_ok());
assert!(file.set_readable_convenience(false).is_ok());
assert!(file.set_executable(false, false).is_ok());
assert!(file.set_executable_convenience(false).is_ok());
assert!(file.can_execute().is_ok());
assert!(file.get_total_space().is_ok());
assert!(file.get_free_space().is_ok());
assert!(file.get_usable_space().is_ok());
assert!(File::create_temp_file("droid".to_string(), None, None).is_ok());
assert!(File::create_temp_file_default("droid".to_string(), None).is_ok());
assert!(file.compare_to(&file).is_ok());
}