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