/** * Constructs a new {@link WriterOutputStream}. * * @param writer the target {@link Writer} * @param decoder the charset decoder * @param bufferSize the size of the output buffer in number of characters * @param writeImmediately If {@code true} the output buffer will be flushed after each * write operation, i.e. all available data will be written to the * underlying {@link Writer} immediately. If {@code false}, the * output buffer will only be flushed when it overflows or when * {@link #flush()} or {@link #close()} is called. * @since 2.1 */ public WriterOutputStream(final Writer writer, final CharsetDecoder decoder, final int bufferSize, final boolean writeImmediately) { checkIbmJdkWithBrokenUTF16( decoder.charset()); this.writer = writer; this.decoder = decoder; this.writeImmediately = writeImmediately; decoderOut = CharBuffer.allocate(bufferSize); }
/** * Returns the canonical name of the encoding used by this writer to convert characters to * bytes, or null if this writer has been closed. Most callers should probably keep * track of the String or Charset they passed in; this method may not return the same * name. */ public String getEncoding() { if (!isOpen()) { return null; } return decoder.charset().name(); }
msg = parsedBuf.buffer.getString(decoder); } catch (Throwable t) { logger.info("Error decoding line with charset (" + decoder.charset() + "). Exception follows.", t); sourceCounter.incrementEventReadFail(); event = syslogParser.parseMessage(msg, decoder.charset(), keepFields); if (parsedBuf.incomplete) { event.getHeaders().put(SyslogUtils.EVENT_STATUS, event = EventBuilder.withBody(msg, decoder.charset()); event.getHeaders().put(SyslogUtils.EVENT_STATUS, SyslogUtils.SyslogStatus.INVALID.getSyslogStatus());
/** * Returns the name of the encoding used to convert bytes into characters. * The value {@code null} is returned if this reader has been closed. * * @return the name of the character converter or {@code null} if this * reader is closed. */ public String getEncoding() { if (!isOpen()) { return null; } return decoder.charset().name(); }
boolean utf16 = decoder.charset().name().startsWith("UTF-16");
boolean utf16 = decoder.charset().name().startsWith("UTF-16");
boolean utf16 = decoder.charset().name().startsWith("UTF-16");
@Override public String getName() { return( decoder.charset().name()); }
/** * Returns the canonical name of the encoding used by this writer to convert characters to * bytes, or null if this writer has been closed. Most callers should probably keep * track of the String or Charset they passed in; this method may not return the same * name. */ public String getEncoding() { if (!isOpen()) { return null; } return decoder.charset().name(); }
/** * Returns the canonical name of the encoding used by this writer to convert characters to * bytes, or null if this writer has been closed. Most callers should probably keep * track of the String or Charset they passed in; this method may not return the same * name. */ public String getEncoding() { if (!isOpen()) { return null; } return decoder.charset().name(); }
static CharsetDecoder getDecoder(Charset charset, ThreadLocal<Reference<CharsetDecoder>> localDecoder) { Reference<CharsetDecoder> ref = localDecoder.get(); CharsetDecoder decoder; return ref != null && (decoder = ref.get()) != null && decoder.charset() == charset ? decoder : initDecoder(charset, localDecoder); }
public String toString() { final StringBuffer buffer = new StringBuffer(); buffer.append("SVNCharsetConvertor"); buffer.append("[from=").append(myDecoder.charset().displayName()); buffer.append(", to=").append(myEncoder.charset().displayName()); buffer.append(']'); return buffer.toString(); } }
/** * Returns the canonical name of the encoding used by this writer to convert characters to * bytes, or null if this writer has been closed. Most callers should probably keep * track of the String or Charset they passed in; this method may not return the same * name. */ public String getEncoding() { if (!isOpen()) { return null; } return decoder.charset().name(); }
/** * Returns the canonical name of the encoding used by this writer to convert characters to * bytes, or null if this writer has been closed. Most callers should probably keep * track of the String or Charset they passed in; this method may not return the same * name. */ public String getEncoding() { if (!isOpen()) { return null; } return decoder.charset().name(); }
/** * Returns the canonical name of the encoding used by this writer to convert characters to * bytes, or null if this writer has been closed. Most callers should probably keep * track of the String or Charset they passed in; this method may not return the same * name. */ public String getEncoding() { if (!isOpen()) { return null; } return decoder.charset().name(); }
public String toString() { final StringBuffer buffer = new StringBuffer(); buffer.append("SVNCharsetConvertor"); buffer.append("[from=").append(myDecoder.charset().displayName()); buffer.append(", to=").append(myEncoder.charset().displayName()); buffer.append(']'); return buffer.toString(); } }
/** * Returns the canonical name of the encoding used by this writer to convert characters to * bytes, or null if this writer has been closed. Most callers should probably keep * track of the String or Charset they passed in; this method may not return the same * name. */ public String getEncoding() { if (!isOpen()) { return null; } return decoder.charset().name(); }
static CharsetDecoder getDecoder(Charset charset, ThreadLocal<Reference<CharsetDecoder>> localDecoder) { Reference<CharsetDecoder> ref = localDecoder.get(); CharsetDecoder decoder; return ref != null && (decoder = ref.get()) != null && decoder.charset() == charset ? decoder : initDecoder(charset, localDecoder); }
private void checkResult(CoderResult cr) throws IOException { if (!cr.isUnderflow() && cr.isError()) { if (cr.isMalformed() || cr.isUnmappable()) { try { cr.throwException(); } catch (CharacterCodingException e) { throw new IOException(CorePlugin.Util.gs(CorePlugin.Event.TEIID10082, cd.charset().displayName(), bytesProcessed + bb.position() + 1), e); } } cr.throwException(); } }
private void checkResult(CoderResult cr) throws IOException { if (!cr.isUnderflow() && cr.isError()) { if (cr.isMalformed() || cr.isUnmappable()) { try { cr.throwException(); } catch (CharacterCodingException e) { throw new IOException(CorePlugin.Util.gs(CorePlugin.Event.TEIID10082, cd.charset().displayName(), bytesProcessed + bb.position() + 1), e); } } cr.throwException(); } }