public class FileHandle extends BaseHandle<java.io.File,java.io.File> implements ResendableContentHandle<java.io.File,java.io.File>, BinaryReadHandle, BinaryWriteHandle, GenericReadHandle, GenericWriteHandle, JSONReadHandle, JSONWriteHandle, TextReadHandle, TextWriteHandle, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle, CtsQueryWriteHandle, QuadsWriteHandle, TriplesReadHandle, TriplesWriteHandle
UNKNOWN_LENGTH| Constructor and Description |
|---|
FileHandle()
Zero-argument constructor.
|
FileHandle(java.io.File content)
Initializes the handle with a file containing
the content.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.File |
bytesToContent(byte[] buffer)
Converts a byte serialization to the content
representation.
|
byte[] |
contentToBytes(java.io.File content)
Converts the content representation to
bytes.
|
void |
fromBuffer(byte[] buffer)
Sets the content of the handle by copying from a
byte array buffer encoded in UTF-8.
|
java.io.File |
get()
Returns the file for the handle content.
|
java.lang.Class<java.io.File> |
getContentClass()
Returns the class of the handled content, which
may be a base class of the actual class of a content object.
|
java.io.File[] |
newArray(int length)
Constructs an array for the handled content
representation
|
static ContentHandleFactory |
newFactory()
Creates a factory to create a FileHandle for a
file.
|
FileHandle |
newHandle()
Constructs a new handle for the same content
representation, initializing the new handle with the same format
and mime type.
|
FileHandle[] |
newHandleArray(int length)
Constructs an uninitialized array with the
specified length with items of the same content
representation.
|
protected
java.lang.Class<java.io.File> |
receiveAs() |
protected void |
receiveContent(java.io.File content) |
protected java.io.File |
sendContent() |
void |
set(java.io.File content)
Assigns a file as the content.
|
byte[] |
toBuffer()
Copies the content of the handle to a byte array
buffer encoded in UTF-8.
|
java.io.File |
toContent(java.io.File serialization)
Converts the serialization to the content
representation.
|
FileHandle |
with(java.io.File content)
Assigns a file as the content and returns the
handle as a fluent convenience.
|
FileHandle |
withFormat(Format format)
Specifies the format of the content and returns
the handle as a fluent convenience.
|
FileHandle |
withMimetype(java.lang.String mimetype)
Specifies the mime type of the content and
returns the handle as a fluent convenience.
|
getByteLength,
getFormat,
getMimetype,
getServerTimestamp,
setByteLength,
setFormat,
setMimetype,
setServerTimestampgetPointInTimeQueryTimestamp, isResendable,
setPointInTimeQueryTimestamp, setResendable,
setResponseServerTimestampclone, equals, finalize, getClass, hashCode, notify,
notifyAll, toString, wait, wait, waitnewHandle,
resendableHandleForresendableHandleForpublic FileHandle()
public FileHandle(java.io.File content)
content - the filepublic static ContentHandleFactory newFactory()
public java.io.File get()
get in interface ContentHandle<java.io.File>public void set(java.io.File content)
set in interface ContentHandle<java.io.File>content - the filepublic FileHandle with(java.io.File content)
content - the filepublic java.lang.Class<java.io.File> getContentClass()
ContentHandle
getContentClass in interface ContentHandle<java.io.File>public FileHandle newHandle()
ContentHandle
newHandle in interface BufferableContentHandle<java.io.File,java.io.File>
newHandle in interface ContentHandle<java.io.File>
newHandle in interface ResendableContentHandle<java.io.File,java.io.File>public FileHandle[] newHandleArray(int length)
BufferableContentHandle
newHandleArray in interface BufferableContentHandle<java.io.File,java.io.File>
newHandleArray in interface ResendableContentHandle<java.io.File,java.io.File>length - the number of positions in the arraypublic java.io.File[] newArray(int length)
ContentHandle
newArray in interface ContentHandle<java.io.File>length - the size of the array (zero or more)public FileHandle withFormat(Format format)
format - the format of the contentpublic FileHandle withMimetype(java.lang.String mimetype)
mimetype - the mime type of the contentpublic java.io.File toContent(java.io.File serialization)
BufferableContentHandle
toContent in interface BufferableContentHandle<java.io.File,java.io.File>serialization - a serialization of the
contentprotected java.lang.Class<java.io.File> receiveAs()
receiveAs in
class com.marklogic.client.impl.HandleImplementation<java.io.File,java.io.File>protected void receiveContent(java.io.File content)
receiveContent in
class com.marklogic.client.impl.HandleImplementation<java.io.File,java.io.File>protected java.io.File sendContent()
sendContent in
class com.marklogic.client.impl.HandleImplementation<java.io.File,java.io.File>public void fromBuffer(byte[] buffer)
BufferableHandle
fromBuffer in interface BufferableHandlebuffer - the byte arraypublic byte[] toBuffer()
BufferableHandle
toBuffer in interface BufferableHandlepublic java.io.File bytesToContent(byte[] buffer)
BufferableContentHandle
bytesToContent in interface BufferableContentHandle<java.io.File,java.io.File>buffer - the byte serializationpublic byte[] contentToBytes(java.io.File content)
BufferableContentHandle
contentToBytes in interface BufferableContentHandle<java.io.File,java.io.File>content - the contentCopyright © 2024 MarkLogic Corporation. All Rights Reserved.