Code example for LittleEndianDataOutputStream

0
    public BufferedFileDataOutputStream(File file, ByteOrder order, int bufferSize) throws FileNotFoundException {
        raf = new RandomAccessFile(file, "rw");
        this.channel = raf.getChannel();
        buffer = ByteBuffer.allocate(bufferSize);
        if (order == ByteOrder.LITTLE_ENDIAN) {
            dataOut = new LittleEndianDataOutputStream(this);
        } else if (order == ByteOrder.BIG_ENDIAN) {
            dataOut = new DataOutputStream(this);
        } else { 
            throw new IllegalArgumentException(order+" is not ByteOrder.BIG_ENDIAN or ByteOrder.LITTLE_ENDIAN");
        } 
    } 
 
    @Override 
    public void write(final int b) throws IOException {
        if (buffer.remaining() == 0) {
            flush(); 
        } 
        buffer.put((byte)b);
    } 
Contextual code suggestions in your IDE  Get Codota for Java