public static boolean writeString(ByteBuffer buffer, String value)
	{
		if (buffer.remaining() < getStoredSpace(value)) {
			return false;
		}
		
		char[] chars = value.toCharArray();
	
		buffer.putShort((short)chars.length);
		
		// Convert from chars to bytes
		for (int i = 0; i < chars.length; i++) {
			buffer.put((byte)chars[i]);
		}
		
		return true;
	}