Here you can find the source of writeFakeImageData(ByteBuffer out, int lzwMinCodeSize)
public static void writeFakeImageData(ByteBuffer out, int lzwMinCodeSize)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static void writeFakeImageData(ByteBuffer out, int lzwMinCodeSize) { // 1 for lzwMinCodeSize, 1 for length, 1 for min content, 1 for block terminator. verifyRemaining(out, 4);// w ww . j a va2s . c o m verifyShortValues(lzwMinCodeSize); out.put((byte) lzwMinCodeSize); // Block length. out.put((byte) 0x01); // Block content. out.put((byte) 0x01); // End of block. out.put((byte) 0x00); } private static void verifyRemaining(ByteBuffer buffer, int expected) { if (buffer.remaining() < expected) { throw new IllegalArgumentException("Must have at least " + expected + " bytes to write"); } } private static void verifyShortValues(int... shortValues) { for (int dimen : shortValues) { if (dimen > Short.MAX_VALUE || dimen < 0) { throw new IllegalArgumentException( "Must pass in non-negative short dimensions, not: " + dimen); } } } }