App Engine Java SDK version 1.7.0
[gae.git] / java / src / main / com / google / appengine / api / files / FileStat.java
bloba28a7f5a4e5591c501dd0aacd186a3a2e31b3f4f
1 // Copyright 2012 Google Inc. All Rights Reserved.
3 package com.google.appengine.api.files;
5 import static java.lang.String.format;
7 /**
8 * A {@link FileStat} contains information about a single file.
11 public final class FileStat {
13 private String filename;
14 private boolean finalized;
15 private Long length;
16 private Long ctime;
17 private Long mtime;
19 @Override
20 public boolean equals(Object obj) {
21 if (obj instanceof FileStat) {
22 return filename.equals(((FileStat) obj).filename);
24 return false;
27 @Override
28 public int hashCode() {
29 return filename.hashCode();
32 @Override
33 public String toString() {
34 return format("FileStat for %s: length %d, ctime %d, mtime %d, finalized %b.",
35 filename, length, ctime, mtime, finalized);
38 /**
39 * @param filename the uploaded filename of the file.
41 public void setFilename(String filename) {
42 this.filename = filename;
45 /**
46 * @param finalized whether the file is finalized.
48 public void setFinalized(boolean finalized) {
49 this.finalized = finalized;
52 /**
53 * @param length the number of bytes of the file.
55 public void setLength(long length) {
56 this.length = length;
59 /**
60 * @param ctime creation time.
62 public void setCtime(long ctime) {
63 this.ctime = ctime;
66 /**
67 * @param mtime modification time.
69 public void setMtime(long mtime) {
70 this.mtime = mtime;
73 /**
74 * @return the filename.
76 public String getFilename() {
77 return filename;
80 /**
81 * @return whether or not the file is finalized
83 public boolean isFinalized() {
84 return finalized;
87 /**
88 * @return the length. {@code null} if not set.
90 public Long getLength() {
91 return length;
94 /**
95 * This field is never set under current implementation.
97 * @return the ctime. {@code null} if not set.
99 public Long getCtime() {
100 return ctime;
104 * This field is never set under current implementation.
106 * @return the mtime. {@code null} if not set.
108 public Long getMtime() {
109 return mtime;