Class: Hadoop::DFS::FileInfo
- Inherits:
-
Object
- Object
- Hadoop::DFS::FileInfo
- Defined in:
- ext/hdfs/hdfs.c
Defined Under Namespace
Instance Method Summary collapse
-
#block_size ⇒ Object
Returns the block size of the file described by this object.
-
#group ⇒ Object
Returns the group of the file described by this object.
-
#is_directory? ⇒ Boolean
Returns True if the file described by this object is a directory; otherwise, returns False.
-
#is_file? ⇒ Boolean
Returns True if the file described by this object is a file; otherwise, returns False.
-
#last_access ⇒ Object
Returns the time of last access as an Integer representing seconds since the epoch.
-
#last_modified ⇒ Object
Returns the time of last modification as an Integer representing seconds since the epoch for the file.
-
#last_modified ⇒ Object
Returns the time of last modification as an Integer representing seconds since the epoch.
-
#name ⇒ Object
Returns the name of the file as a String.
-
#owner ⇒ Object
Returns the owner of the file as a String.
-
#replication ⇒ Object
Returns the replication factor of the file as an Integer.
-
#name ⇒ Object
Returns the size of the file as an Integer.
-
#to_s ⇒ Object
Returns a human-readable representation of a Hadoop::DFS::FileSystem object as a String.
Instance Method Details
#block_size ⇒ Object
Returns the block size of the file described by this object.
944 945 946 947 948 |
# File 'ext/hdfs/hdfs.c', line 944
VALUE HDFS_File_Info_block_size(VALUE self) {
FileInfo* file_info = NULL;
Data_Get_Struct(self, FileInfo, file_info);
return LONG2NUM(file_info->mBlockSize);
}
|
#group ⇒ Object
Returns the group of the file described by this object.
956 957 958 959 960 |
# File 'ext/hdfs/hdfs.c', line 956
VALUE HDFS_File_Info_group(VALUE self) {
FileInfo* file_info = NULL;
Data_Get_Struct(self, FileInfo, file_info);
return rb_str_new2(file_info->mGroup);
}
|
#is_directory? ⇒ Boolean
Returns True if the file described by this object is a directory; otherwise, returns False.
969 970 971 |
# File 'ext/hdfs/hdfs.c', line 969 VALUE HDFS_File_Info_is_directory(VALUE self) { return Qfalse; } |
#is_file? ⇒ Boolean
Returns True if the file described by this object is a file; otherwise, returns False.
980 981 982 |
# File 'ext/hdfs/hdfs.c', line 980 VALUE HDFS_File_Info_is_file(VALUE self) { return Qfalse; } |
#last_access ⇒ Object
Returns the time of last access as an Integer representing seconds since the epoch.
999 1000 1001 1002 1003 |
# File 'ext/hdfs/hdfs.c', line 999
VALUE HDFS_File_Info_last_access(VALUE self) {
FileInfo* file_info = NULL;
Data_Get_Struct(self, FileInfo, file_info);
return LONG2NUM(file_info->mLastAccess);
}
|
#last_modified ⇒ Object
Returns the time of last modification as an Integer representing seconds since the epoch for the file
1012 1013 1014 1015 1016 |
# File 'ext/hdfs/hdfs.c', line 1012
VALUE HDFS_File_Info_last_modified(VALUE self) {
FileInfo* file_info = NULL;
Data_Get_Struct(self, FileInfo, file_info);
return LONG2NUM(file_info->mLastMod);
}
|
#last_modified ⇒ Object
Returns the time of last modification as an Integer representing seconds since the epoch.
1025 1026 1027 1028 1029 |
# File 'ext/hdfs/hdfs.c', line 1025
VALUE HDFS_File_Info_mode(VALUE self) {
FileInfo* file_info = NULL;
Data_Get_Struct(self, FileInfo, file_info);
return INT2NUM(decimal_octal(file_info->mPermissions));
}
|
#name ⇒ Object
Returns the name of the file as a String.
1037 1038 1039 1040 1041 |
# File 'ext/hdfs/hdfs.c', line 1037
VALUE HDFS_File_Info_name(VALUE self) {
FileInfo* file_info = NULL;
Data_Get_Struct(self, FileInfo, file_info);
return rb_str_new(file_info->mName, strlen(file_info->mName));
}
|
#owner ⇒ Object
Returns the owner of the file as a String.
1049 1050 1051 1052 1053 |
# File 'ext/hdfs/hdfs.c', line 1049
VALUE HDFS_File_Info_owner(VALUE self) {
FileInfo* file_info = NULL;
Data_Get_Struct(self, FileInfo, file_info);
return rb_str_new(file_info->mOwner, strlen(file_info->mOwner));
}
|
#replication ⇒ Object
Returns the replication factor of the file as an Integer.
1061 1062 1063 1064 1065 |
# File 'ext/hdfs/hdfs.c', line 1061
VALUE HDFS_File_Info_replication(VALUE self) {
FileInfo* file_info = NULL;
Data_Get_Struct(self, FileInfo, file_info);
return INT2NUM(file_info->mReplication);
}
|
#name ⇒ Object
Returns the size of the file as an Integer.
1073 1074 1075 1076 1077 |
# File 'ext/hdfs/hdfs.c', line 1073
VALUE HDFS_File_Info_size(VALUE self) {
FileInfo* file_info = NULL;
Data_Get_Struct(self, FileInfo, file_info);
return LONG2NUM(file_info->mSize);
}
|
#to_s ⇒ Object
Returns a human-readable representation of a Hadoop::DFS::FileSystem object as a String.
1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 |
# File 'ext/hdfs/hdfs.c', line 1086
VALUE HDFS_File_Info_to_s(VALUE self) {
FileInfo* file_info = NULL;
Data_Get_Struct(self, FileInfo, file_info);
// Introspects current class, returns it as a String.
VALUE class_string = rb_funcall(
rb_funcall(self, rb_intern("class"), 0),
rb_intern("to_s"), 0);
char* output;
VALUE string_value = rb_str_new2("");
// If asprintf was successful, creates a Ruby String.
if (asprintf(&output, "#<%s: %s, mode=%d, owner=%s, group=%s>",
RSTRING_PTR(class_string), file_info->mName,
decimal_octal(file_info->mPermissions), file_info->mOwner,
file_info->mGroup) >= 0) {
string_value = rb_str_new(output, strlen(output));
}
free(output);
return string_value;
}
|