Java File Write via ByteBuffer writeShort(int i, DataOutput out)

Here you can find the source of writeShort(int i, DataOutput out)

Description

write Short

License

Open Source License

Declaration

private static void writeShort(int i, DataOutput out) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    private static void writeShort(int i, DataOutput out) throws IOException {
        ByteBuffer bb = ByteBuffer.allocate(2).order(ByteOrder.LITTLE_ENDIAN);
        bb.putShort((short) i);
        out.write(bb.array());/*www  .ja  va 2 s .  c  o m*/
    }
}

Related

  1. writeInt(WritableByteChannel channel, int value)
  2. writeLong(OutputStream in, long i)
  3. writeLong(OutputStream os, Long d)
  4. writeLong(RandomAccessFile raFile, long num)
  5. writeObject(Serializable serializable)
  6. writeString(ByteArrayOutputStream bout, String val)
  7. writeStringContents(String contents, WritableByteChannel channel)
  8. writeStringData(DataOutputStream mDataOutputStream, String token)
  9. writeStringToSocketChannel(String text, SocketChannel sc)