import java.util.*;
import java.io.UnsupportedEncodingException;

class USB {

    private static final int BULK_SIZE = 256;
   
    // Load the library
    static {
        System.loadLibrary("USBnativelib");
    }

    // Native method declarations
    public static native void   bulk_send(String data);
    public static native String bulk_receive();

    public static void send(String data) throws UnsupportedEncodingException {
/*        String tmp;
        int start = 0;
        int end   = start + BULK_SIZE;
        do {
            while(end > data.length()) {
                end--;
            }
            if (start > end) {
                return;
            }
            tmp = data.substring(start, end);
            System.out.println(tmp);
            bulk_send(tmp);
            start = end + 1;
            end += BULK_SIZE;
        } while (start < data.length());*/
        bulk_send(data);
    }

    public static String receive() {
        return bulk_receive();
    }
}

