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.
926 927 928 929 930 |
# File 'ext/hdfs/hdfs.c', line 926 VALUE HDFS_File_Info_block_size(VALUE self) { FileInfo* file_info = NULL; Data_Get_Struct(self, FileInfo, file_info); return INT2NUM(file_info->mBlockSize); } |
#group ⇒ Object
Returns the group of the file described by this object.
938 939 940 941 942 |
# File 'ext/hdfs/hdfs.c', line 938 VALUE HDFS_File_Info_group(VALUE self) { FileInfo* file_info = NULL; Data_Get_Struct(self, FileInfo, file_info); return rb_str_new(file_info->mGroup, strlen(file_info->mGroup)); } |
#is_directory? ⇒ Boolean
Returns True if the file described by this object is a directory; otherwise, returns False.
951 952 953 |
# File 'ext/hdfs/hdfs.c', line 951 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.
962 963 964 |
# File 'ext/hdfs/hdfs.c', line 962 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.
981 982 983 984 985 |
# File 'ext/hdfs/hdfs.c', line 981 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
994 995 996 997 998 |
# File 'ext/hdfs/hdfs.c', line 994 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.
1007 1008 1009 1010 1011 |
# File 'ext/hdfs/hdfs.c', line 1007 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.
1019 1020 1021 1022 1023 |
# File 'ext/hdfs/hdfs.c', line 1019 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.
1031 1032 1033 1034 1035 |
# File 'ext/hdfs/hdfs.c', line 1031 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.
1043 1044 1045 1046 1047 |
# File 'ext/hdfs/hdfs.c', line 1043 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.
1055 1056 1057 1058 1059 |
# File 'ext/hdfs/hdfs.c', line 1055 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.
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 |
# File 'ext/hdfs/hdfs.c', line 1068 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; } |