Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {
    public static void writeByteBuffer(byte[] buf, DataOutput out) throws Exception {
        writeByteBuffer(buf, 0, buf.length, out);
    }

    public static void writeByteBuffer(byte[] buf, int offset, int length, DataOutput out) throws Exception {
        if (buf != null) {
            out.write(1);
            out.writeInt(length);
            out.write(buf, offset, length);
        } else {
            out.write(0);
        }
    }
}