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.
835 836 837 838 839 |
# File 'ext/hdfs/hdfs.c', line 835 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.
847 848 849 850 851 |
# File 'ext/hdfs/hdfs.c', line 847 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.
860 861 862 |
# File 'ext/hdfs/hdfs.c', line 860 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.
871 872 873 |
# File 'ext/hdfs/hdfs.c', line 871 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.
890 891 892 893 894 |
# File 'ext/hdfs/hdfs.c', line 890 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
903 904 905 906 907 |
# File 'ext/hdfs/hdfs.c', line 903 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.
916 917 918 919 920 |
# File 'ext/hdfs/hdfs.c', line 916 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.
928 929 930 931 932 |
# File 'ext/hdfs/hdfs.c', line 928 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.
940 941 942 943 944 |
# File 'ext/hdfs/hdfs.c', line 940 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.
952 953 954 955 956 |
# File 'ext/hdfs/hdfs.c', line 952 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.
964 965 966 967 968 |
# File 'ext/hdfs/hdfs.c', line 964 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.
977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 |
# File 'ext/hdfs/hdfs.c', line 977 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; } |