Revision created by MOE tool push_codebase.
[gae.git] / java / src / main / com / google / appengine / api / files / RecordWriteChannel.java
blobbedfb99a7c413a9483140035723bbce2fede9f72
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;
9 /**
10 * A {@link WritableByteChannel} for writing records to a {@link FileWriteChannel}.
11 * <p>
12 * The format of these records is defined by the leveldb log format:
13 * http://leveldb.googlecode.com/svn/trunk/doc/log_format.txt
14 * </p>
15 * <p>
16 * An instance of {@link RecordWriteChannel} may be obtained from the method:
17 * {@link FileService#openRecordWriteChannel(AppEngineFile, boolean)}.
18 * </p>
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 {
27 /**
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;
33 /**
34 * Closes the file.
35 * @see com.google.appengine.api.files.FileWriteChannel#closeFinally()
37 public void closeFinally() throws IllegalStateException, IOException;