public void write(int c) throws IOException { super.write(c); if (out2 != null && count < lim) { out2.write(c); } count++; }
public void write(char[] cbuf, int off, int len) throws IOException { super.write(cbuf, off, len); if (out2 != null && count < lim) { out2.write(cbuf, off, len); } count += len; }
public void write(String str, int off, int len) throws IOException { super.write(str, off, len); if (out2 != null && count < lim) { out2.write(str, off, len); } count += len; }
@Override public void write(String arg0) throws IOException { if (firstNonWhiteSpace) { super.write(arg0); } else { char[] stringChar = arg0.toCharArray(); for (int i = 0; i < stringChar.length; i++) { if (stringChar[i] > 32) { firstNonWhiteSpace = true; super.write(arg0.substring(i, stringChar.length)); break; } } } }
@Override public void write(char[] arg0) throws IOException { if (firstNonWhiteSpace) { super.write(arg0); } else { for (int i = 0; i < arg0.length; i++) { if (arg0[i] > 32) { firstNonWhiteSpace = true; } if (firstNonWhiteSpace) { super.write(arg0[i]); } } } }
public void write(int c) throws IOException { // TODO: We should actually count the Utf-8 bytes, not the characters. if (c == '\n') { // Reset the character count. counter = 0; } else if (counter == 70) { // Insert a newline and a space. super.write('\n'); super.write(' '); counter = 2; } else { counter++; } super.write(c); }
@Override public void write(int c) throws IOException { if (c < 32) { switch (c) { case 9: break; case 10: break; case 13: break; default: // replace by space super.write(' '); return; } } super.write(c); }
public void write(int c) throws IOException { if ((c >= ' ' && c <= '\u007e') || c == '\r' || c == '\n') super.write(c); else { super.write('\\'); super.write('u'); String number = Integer.toHexString(c); if (number.length() < 4) number = zeros.substring(0, 4 - number.length()) + number; super.write(number.charAt(0)); super.write(number.charAt(1)); super.write(number.charAt(2)); super.write(number.charAt(3)); } }
public void close() throws IOException { final LogEvent event = new DefaultLogEventMapper().map(message); StringWriter w2 = out2; if (w2 == null) { w2 = (StringWriter) out; } String ct = (String) message.get(Message.CONTENT_TYPE); StringBuilder payload = new StringBuilder(); try { writePayload(payload, w2, ct); } catch (Exception ex) { // ignore } event.setPayload(payload.toString()); sender.send(event); message.setContent(Writer.class, out); super.close(); }
public void close() throws IOException { LoggingMessage buffer = setupBuffer(message); if (count >= lim) { buffer.getMessage().append("(message truncated to " + lim + " bytes)\n"); } StringWriter w2 = out2; if (w2 == null) { w2 = (StringWriter) out; } String ct = (String) message.get(Message.CONTENT_TYPE); try { writePayload(buffer.getPayload(), w2, ct); } catch (Exception ex) { // ignore } log(logger, formatLoggingMessage(buffer)); message.setContent(Writer.class, out); super.close(); }
public void write(String str, int off, int len) throws IOException { mLog.debug(str.substring(off, off + len)); super.write(str, off, len); }
public void write(char cbuf[], int off, int len) throws IOException { mLog.debug(new String(cbuf, off, len)); super.write(cbuf, off, len); }