/*
(non-Javadoc)
@see org.overture.interpreter.messages.rtlog.IRTLogger#dump(boolean)
199559
@Override
	public synchronized void dump(boolean close)
	{
		if (logfile != null)
		{
			PrintWriter writer = null;

			try
			{
				writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(logfile, true), "UTF-8"));
			} catch (FileNotFoundException e)
			{
				e.printStackTrace();
				return;
			} catch (UnsupportedEncodingException e)
			{
				e.printStackTrace();
				return;
			}

			for (RTMessage event : events)
			{
				writer.println(event.getMessage());
			}

			writer.flush();
			events.clear();

			writer.close();
		}
	}
277514
static public void dumpArrayToTraceLog(byte[] arr) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "[ ");
            if (null == arr) {
                Tr.debug(tc, "null");
            } else {
                for (int i = 0; i < arr.length; i++) {
                    Tr.debug(tc, arr[i] + " ");
                }
            }
            Tr.debug(tc, "]");
        }
    }
23238
public void dump() throws IOException {
    FileWriter out = new FileWriter(outFile, true);
    try {
      dump(out);
    } finally {
      out.close();
    }
  }
435297
private boolean dumpCache(){
        if (CacheDumpLogger.isDebugEnabled()) {
            try {
                List<ModelService> services = new ArrayList<ModelService>();
                services.addAll(getCache().values());
                StringBuilder sb = new StringBuilder();
                sb.append("LookupManager dumpped Service Cache at: ").append(System.currentTimeMillis()).append("\n");
                for (ModelService service : services) {
                    sb.append(new String(serialize(service))).append("\n");
                }
                CacheDumpLogger.debug(sb.toString());
            } catch (Exception e) {
                LOGGER.warn("Dump Service Cache failed. Set Logger {} to INFO to disable this message.",
                            CacheDumpLogger.getName());
                if (LOGGER.isTraceEnabled()) {
                    LOGGER.trace("Dump Service Cache failed. ", e);
                }
                return false;
            }
            return true;
        }
        return false;

    }
1340734
@Override
	public void writeBoolean(boolean value) throws JMSException
    {
        try
        {
            getOutput().writeBoolean(value);
        }
        catch (IOException e)
        {
        	throw new FFMQException("Cannot write message body","IO_ERROR",e);
        }
    }
216968
public void dumpLogBuffer(String identifier)
  {
    final ArrayList<LogRecord> logBufferCopy;
    final PrintWriter logDumper;
    final OutputStream outStream;
    Formatter formatter = this.getFormatter();

    // Check if compression of dump file is enabled
    boolean disableCompression =
        System.getProperty(DISABLE_DUMP_COMPR_PROP) != null;

    // If no identifying factor (eg, an incident id) was provided, get one
    if (identifier == null)
    {
      identifier = EventUtil.getDumpFileId();
    }

    // Do some sanity checking to make sure we're not flooding the user's
    // disk with dump files
    cleanupSfDumps(true);

    String logDumpPath = logDumpPathPrefix + "/" + LOG_DUMP_FILE_NAME +
                         identifier + LOG_DUMP_FILE_EXT;

    if (!disableCompression)
    {
      logDumpPath += LOG_DUMP_COMP_EXT;
    }

    logger.debug("EventHandler dumping log buffer to {}", logDumpPath);

    // Copy logBuffer because this is potentially long running.
    synchronized (this)
    {
      logBufferCopy = new ArrayList<>(logBuffer);
      logBuffer.clear();
    }

    File outputFile = new File(logDumpPath);

    /**
     * Because log files could potentially be very large, we should never open
     * them in append mode. It's rare that this should happen anyways...
     */
    try
    {
      // If the dump path doesn't already exist, create it.
      if (outputFile.getParentFile() != null)
      {
        outputFile.getParentFile().mkdirs();
      }

      outStream = disableCompression ?
                  new FileOutputStream(logDumpPath, false) :
                  new GZIPOutputStream(new FileOutputStream(logDumpPath, false));

      logDumper = new PrintWriter(outStream, true);
    }
    catch (IOException exc)
    {
      // Not much to do here, can't dump logs so exit out.
      logger.debug("Log dump failed, exception: {}", exc.getMessage());

      return;
    }

    // Iterate over log entries, format them, then dump them.
    for (LogRecord entry : logBufferCopy)
    {
      logDumper.write(formatter != null ? formatter.format(entry) :
                      entry.getMessage());
    }

    // Clean up
    logDumper.flush();
    logDumper.close();
  }
103547
private boolean dumpCache() throws Exception{

        if(CacheDumpLogger.isDebugEnabled()){

            List<ModelService> services = getCache().getAllServicesWithInstance();
             if(dumper == null){
                 dumper = new JsonSerializer();
             }

            StringBuilder sb = new StringBuilder();
            sb.append("LookupManager dump Service Cache at: ").append(System.currentTimeMillis()).append("\n");
            for(ModelService service : services){
                sb.append(new String(dumper.serialize(service))).append("\n");
            }
            CacheDumpLogger.debug(sb.toString());
            return true;
        } else {
            return false;
        }
    }
355427
@Override
	public void dump(Writer writer, Pattern filter) throws IOException {
		String linesep = System.getProperty("line.separator"); //$NON-NLS-1$
		for (Map.Entry<String, ILayer> entry : cacheMap.entrySet()) {
			if (filter != null) {
				Matcher m = filter.matcher(entry.getKey());
				if (!m.find())
					continue;
			}
			writer.append("ILayer key: ").append(entry.getKey()).append(linesep); //$NON-NLS-1$
			writer.append(entry.getValue().toString()).append(linesep).append(linesep);
		}
		writer.append("Number of layer cache entires = ").append(Integer.toString(cacheMap.size())).append(linesep); //$NON-NLS-1$
		writer.append("Number of layer cache evictions = ").append(Integer.toString(numEvictions.get())).append(linesep); //$NON-NLS-1$
	}
926450
public boolean dumpTo(File outFile) throws IOException {
        if (exists()) {
            dump(getOffset(), outFile);
            return true;
        } else {
            return false;
        }
    }
204879
public JBBPOut Bool(final boolean... value) throws IOException {
    assertNotEnded();
    assertArrayNotNull(value);
    if (this.processCommands) {
      for (final boolean b : value) {
        this.outStream.write(b ? 1 : 0);
      }
    }
    return this;
  }
266953
@Override
	protected void serializeTo(RawDataBuffer out)
    {
        super.serializeTo(out);
    	if (message != null)
        {
            out.writeBoolean(true);
            MessageSerializer.serializeTo(message, out);
        }
        else
            out.writeBoolean(false);
    }
761145
public void dumpTo(AreaTree tree, PrintWriter out)
    {
        if (produceHeader)
        {
            out.println("<!DOCTYPE html>");
            out.println("<html>");
            out.println("<head>");
            out.println("<title>" + tree.getRoot().getPage().getTitle() + "</title>");
            out.println("<meta charset=\"utf-8\">");
            out.println("<meta name=\"generator\" content=\"FITLayout - area tree dump\">");
            out.println("</head>");
            out.println("<body>");
        }
        recursiveDumpArea(tree.getRoot(), 1, out);
        if (produceHeader)
        {
            out.println("</body>");
            out.println("</html>");
        }
    }
89996
public static void setLogStdOut(boolean log)
    {
        if (log)
        {
            if (!(System.out instanceof LogStream))
                System.setOut(new LogStream.STDOUT());
        }
        else
            System.setOut(STDOUT_STREAM);
    }
163299
@SuppressWarnings("unused")
    @Internal
    void dump() {
        System.out.println("declaredAnnotations = " + declaredAnnotations);
        System.out.println("declaredStereotypes = " + declaredStereotypes);
        System.out.println("allAnnotations = " + allAnnotations);
        System.out.println("allStereotypes = " + allStereotypes);
        System.out.println("annotationsByStereotype = " + annotationsByStereotype);
    }
245230
public static String dump(TreeNode node) {
    DebugASTDump dumper = new DebugASTDump();
    node.accept(dumper);
    dumper.sb.newline();
    return dumper.toString();
  }
86379
@SuppressWarnings("unused")
    private static final void dump(IoBuffer data) {
        log.debug("Hex: {}", data.getHexDump());
        int pos = data.position();
        byte[] bar = new byte[data.limit() - data.position()];
        data.get(bar);
        log.debug("Str {}", new String(bar));
        bar = null;
        data.position(pos);
    }
506544
public String dump()
   {
      StringBuilder vals = new StringBuilder("Property ");
      try
      {
         vals = new StringBuilder(getPath()).append(" values: ");
         for (int i = 0; i < getValueArray().length; i++)
         {
            vals.append(ValueDataUtil.getString(((BaseValue)getValueArray()[i]).getInternalData())).append(";");
         }
      }
      catch (Exception e)
      {
         LOG.error(e.getLocalizedMessage(), e);
      }
      return vals.toString();
   }