public class TypedFile extends java.lang.Object implements TypedInput, TypedOutput
| Constructor and Description |
|---|
TypedFile(java.lang.String mimeType,
java.io.File file)
Constructs a new typed file.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
java.io.File |
file()
Returns the file.
|
java.lang.String |
fileName()
Original filename.
|
int |
hashCode() |
java.io.InputStream |
in()
Read bytes as stream.
|
long |
length()
Length in bytes.
|
java.lang.String |
mimeType()
Returns the mime type.
|
void |
moveTo(TypedFile destination)
Atomically moves the contents of this file to a new location.
|
java.lang.String |
toString() |
void |
writeTo(java.io.OutputStream out)
Writes these bytes to the given output stream.
|
public TypedFile(java.lang.String mimeType,
java.io.File file)
java.lang.NullPointerException - if file or mimeType is nullpublic java.io.File file()
public java.lang.String mimeType()
TypedInputmimeType in interface TypedInputmimeType in interface TypedOutputpublic long length()
TypedInput-1 if length is unknown.length in interface TypedInputlength in interface TypedOutputpublic java.lang.String fileName()
TypedOutputfileName in interface TypedOutputpublic java.io.InputStream in()
throws java.io.IOException
TypedInputin in interface TypedInputjava.io.IOExceptionpublic void writeTo(java.io.OutputStream out)
throws java.io.IOException
TypedOutputwriteTo in interface TypedOutputjava.io.IOExceptionpublic void moveTo(TypedFile destination) throws java.io.IOException
destination - filejava.io.IOException - if the move failspublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © 2014 Square, Inc.. All Rights Reserved.