Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.iq80.leveldb.util;
  
  import java.io.DataOutput;
 
 public abstract class SliceOutput extends OutputStream implements DataOutput
 {
    
Resets this stream to the initial position.
 
     public abstract void reset();

    
Returns the writerIndex of this buffer.
 
     public abstract int size();

    
Returns the number of writable bytes which is equal to (this.capacity - this.writerIndex).
 
     public abstract int writableBytes();

    
Returns true if and only if (this.capacity - this.writerIndex) is greater than 0.
 
     public abstract boolean isWritable();
 
     @Override
     public final void writeBoolean(boolean value)
     {
         writeByte(value ? 1 : 0);
     }
 
     @Override
     public final void write(int value)
     {
         writeByte(value);
     }

    
Sets the specified byte at the current writerIndex and increases the writerIndex by 1 in this buffer. The 24 high-order bits of the specified value are ignored.

Throws:
java.lang.IndexOutOfBoundsException if this.writableBytes is less than 1
 
     public abstract void writeByte(int value);

    
Sets the specified 16-bit short integer at the current writerIndex and increases the writerIndex by 2 in this buffer. The 16 high-order bits of the specified value are ignored.

Throws:
java.lang.IndexOutOfBoundsException if this.writableBytes is less than 2
 
     public abstract void writeShort(int value);

    
Sets the specified 32-bit integer at the current writerIndex and increases the writerIndex by 4 in this buffer.

Throws:
java.lang.IndexOutOfBoundsException if this.writableBytes is less than 4
 
     public abstract void writeInt(int value);

    
Sets the specified 64-bit long integer at the current writerIndex and increases the writerIndex by 8 in this buffer.

Throws:
java.lang.IndexOutOfBoundsException if this.writableBytes is less than 8
 
     public abstract void writeLong(long value);

    
Transfers the specified source buffer's data to this buffer starting at the current writerIndex until the source buffer becomes unreadable, and increases the writerIndex by the number of the transferred bytes. This method is basically same with writeBytes(org.iq80.leveldb.util.Slice,int,int), except that this method increases the readerIndex of the source buffer by the number of the transferred bytes while writeBytes(org.iq80.leveldb.util.Slice,int,int) does not.

Throws:
java.lang.IndexOutOfBoundsException if source.readableBytes is greater than this.writableBytes
    public abstract void writeBytes(Slice source);

    
Transfers the specified source buffer's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= length). This method is basically same with writeBytes(org.iq80.leveldb.util.Slice,int,int), except that this method increases the readerIndex of the source buffer by the number of the transferred bytes (= length) while writeBytes(org.iq80.leveldb.util.Slice,int,int) does not.

Parameters:
length the number of bytes to transfer
Throws:
java.lang.IndexOutOfBoundsException if length is greater than this.writableBytes or if length is greater then source.readableBytes
    public abstract void writeBytes(SliceInput sourceint length);

    
Transfers the specified source buffer's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= length).

Parameters:
sourceIndex the first index of the source
length the number of bytes to transfer
Throws:
java.lang.IndexOutOfBoundsException if the specified sourceIndex is less than 0, if sourceIndex + length is greater than source.capacity, or if length is greater than this.writableBytes
    public abstract void writeBytes(Slice sourceint sourceIndexint length);
    @Override
    public final void write(byte[] source)
            throws IOException
    {
        writeBytes(source);
    }

    
Transfers the specified source array's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= source.length).

Throws:
java.lang.IndexOutOfBoundsException if source.length is greater than this.writableBytes
    public abstract void writeBytes(byte[] source);
    @Override
    public final void write(byte[] sourceint sourceIndexint length)
    {
        writeBytes(sourcesourceIndexlength);
    }

    
Transfers the specified source array's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= length).

Parameters:
sourceIndex the first index of the source
length the number of bytes to transfer
Throws:
java.lang.IndexOutOfBoundsException if the specified sourceIndex is less than 0, if sourceIndex + length is greater than source.length, or if length is greater than this.writableBytes
    public abstract void writeBytes(byte[] sourceint sourceIndexint length);

    
Transfers the specified source buffer's data to this buffer starting at the current writerIndex until the source buffer's position reaches its limit, and increases the writerIndex by the number of the transferred bytes.

Throws:
java.lang.IndexOutOfBoundsException if source.remaining() is greater than this.writableBytes
    public abstract void writeBytes(ByteBuffer source);

    
Transfers the content of the specified stream to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes.

Parameters:
length the number of bytes to transfer
Returns:
the actual number of bytes read in from the specified stream
Throws:
java.lang.IndexOutOfBoundsException if length is greater than this.writableBytes
java.io.IOException if the specified stream threw an exception during I/O
    public abstract int  writeBytes(InputStream inint lengththrows IOException;

    
Transfers the content of the specified channel to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes.

Parameters:
length the maximum number of bytes to transfer
Returns:
the actual number of bytes read in from the specified channel
Throws:
java.lang.IndexOutOfBoundsException if length is greater than this.writableBytes
java.io.IOException if the specified channel threw an exception during I/O
    public abstract int  writeBytes(ScatteringByteChannel inint lengththrows IOException;
    public abstract int  writeBytes(FileChannel inint positionint lengththrows IOException;

    
Fills this buffer with NUL (0x00) starting at the current writerIndex and increases the writerIndex by the specified length.

Parameters:
length the number of NULs to write to the buffer
Throws:
java.lang.IndexOutOfBoundsException if length is greater than this.writableBytes
    public abstract void writeZero(int length);

    
Returns a slice of this buffer's readable bytes. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method is identical to buf.slice(buf.readerIndex(), buf.readableBytes()). This method does not modify readerIndex or writerIndex of this buffer.
    public abstract Slice slice();

    
Converts this buffer's readable bytes into a NIO buffer. The returned buffer might or might not share the content with this buffer, while they have separate indexes and marks. This method is identical to buf.toByteBuffer(buf.readerIndex(), buf.readableBytes()). This method does not modify readerIndex or writerIndex of this buffer.
    public abstract ByteBuffer toByteBuffer();

    
Decodes this buffer's readable bytes into a string with the specified character set name. This method is identical to buf.toString(buf.readerIndex(), buf.readableBytes(), charsetName). This method does not modify readerIndex or writerIndex of this buffer.

Throws:
java.nio.charset.UnsupportedCharsetException if the specified character set name is not supported by the current VM
    public abstract String toString(Charset charset);
    //
    // Unsupported operations
    //

    
Unsupported operation

    @Override
    public void writeChar(int value)
    {
        throw new UnsupportedOperationException();
    }

    
Unsupported operation

    @Override
    public void writeFloat(float v)
    {
        throw new UnsupportedOperationException();
    }

    
Unsupported operation

    @Override
    public void writeDouble(double v)
    {
        throw new UnsupportedOperationException();
    }

    
Unsupported operation

    @Override
    public void writeChars(String s)
    {
        throw new UnsupportedOperationException();
    }

    
Unsupported operation

    @Override
    public void writeUTF(String s)
    {
        throw new UnsupportedOperationException();
    }

    
Unsupported operation

    @Override
    public void writeBytes(String s)
    {
        throw new UnsupportedOperationException();
    }
New to GrepCode? Check out our FAQ X