1 // Copyright 2011 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.api
.files
;
5 import java
.io
.IOException
;
6 import java
.nio
.ByteBuffer
;
7 import java
.nio
.channels
.WritableByteChannel
;
10 * A {@link WritableByteChannel} for writing records to a {@link FileWriteChannel}.
12 * The format of these records is defined by the leveldb log format:
13 * http://leveldb.googlecode.com/svn/trunk/doc/log_format.txt
16 * An instance of {@link RecordWriteChannel} may be obtained from the method:
17 * {@link FileService#openRecordWriteChannel(AppEngineFile, boolean)}.
19 * Just like {@link WritableByteChannel} If one thread initiates a write operation upon a channel
20 * then any other thread that attempts to initiate another write operation will block until the
21 * first operation is complete.
25 public interface RecordWriteChannel
extends WritableByteChannel
{
28 * Writes the data out to FileWriteChannel.
29 * @see com.google.appengine.api.files.FileWriteChannel#write(ByteBuffer, String)
31 public int write(ByteBuffer src
, String sequenceKey
) throws IOException
;
35 * @see com.google.appengine.api.files.FileWriteChannel#closeFinally()
37 public void closeFinally() throws IllegalStateException
, IOException
;