co.cask.tigon.io
Class BinaryEncoder

java.lang.Object
  extended by co.cask.tigon.io.BinaryEncoder
All Implemented Interfaces:
Encoder

public final class BinaryEncoder
extends Object
implements Encoder

An Encoder for binary-format data.


Constructor Summary
BinaryEncoder(OutputStream output)
           
 
Method Summary
 Encoder writeBool(boolean b)
           
 Encoder writeBytes(byte[] bytes)
           
 Encoder writeBytes(byte[] bytes, int off, int len)
           
 Encoder writeBytes(ByteBuffer buffer)
          Writes out the remaining bytes in ByteBuffer.
 Encoder writeDouble(double d)
           
 Encoder writeFloat(float f)
           
 Encoder writeInt(int i)
           
 Encoder writeLong(long l)
           
 Encoder writeNull()
           
 Encoder writeString(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryEncoder

public BinaryEncoder(OutputStream output)
Method Detail

writeNull

public Encoder writeNull()
                  throws IOException
Specified by:
writeNull in interface Encoder
Throws:
IOException

writeBool

public Encoder writeBool(boolean b)
                  throws IOException
Specified by:
writeBool in interface Encoder
Throws:
IOException

writeInt

public Encoder writeInt(int i)
                 throws IOException
Specified by:
writeInt in interface Encoder
Throws:
IOException

writeLong

public Encoder writeLong(long l)
                  throws IOException
Specified by:
writeLong in interface Encoder
Throws:
IOException

writeFloat

public Encoder writeFloat(float f)
                   throws IOException
Specified by:
writeFloat in interface Encoder
Throws:
IOException

writeDouble

public Encoder writeDouble(double d)
                    throws IOException
Specified by:
writeDouble in interface Encoder
Throws:
IOException

writeString

public Encoder writeString(String s)
                    throws IOException
Specified by:
writeString in interface Encoder
Throws:
IOException

writeBytes

public Encoder writeBytes(byte[] bytes)
                   throws IOException
Specified by:
writeBytes in interface Encoder
Throws:
IOException

writeBytes

public Encoder writeBytes(byte[] bytes,
                          int off,
                          int len)
                   throws IOException
Specified by:
writeBytes in interface Encoder
Throws:
IOException

writeBytes

public Encoder writeBytes(ByteBuffer buffer)
                   throws IOException
Description copied from interface: Encoder
Writes out the remaining bytes in ByteBuffer.

The given ByteBuffer is untouched after this method returns (i.e. same position and limit).

Specified by:
writeBytes in interface Encoder
Throws:
IOException


Copyright © 2014 Cask Data, Inc. Licensed under the Apache License, Version 2.0.