public int write(ByteBuffer b) {
    		if(numReadBytes == 0)
    			return 0;
    		
    		if(b.remaining() < numReadBytes) {
    			numReadBytes = b.remaining();
    		}
    		byte[] data = new byte[numReadBytes];
    		b.get(data);
    		
    		return numReadBytes;
    	}