/** * Get stream encoding or NULL if stream is uninitialized. Call init() or * read() method to initialize it. * @return the name of the character encoding being used by this stream. */ public String getEncoding() { return internalIn2.getEncoding(); }
/** * Get stream encoding or NULL if stream is uninitialized. * Call init() or read() method to initialize it. */ public String getEncoding() { if (internalIn2 == null) return null; return internalIn2.getEncoding(); }
/** * @see InputStreamReader#getEncoding() * @since 1.3 */ public String getEncoding() { return reader.getEncoding(); }
/** * Get stream encoding or NULL if stream is uninitialized. Call init() or * read() method to initialize it. * @return the name of the character encoding being used by this stream. */ public String getEncoding() { return internalIn2.getEncoding(); }
/** * Get the default encoding. * This is done by opening an InputStreamReader on * a dummy InputStream and getting the encoding. * Could use System.getProperty("file.encoding"), but cannot * see where this is documented. * @return the default file encoding. */ public String getDefaultEncoding() { InputStreamReader is = new InputStreamReader( new InputStream() { //NOSONAR @Override public int read() { return -1; } }); try { return is.getEncoding(); } finally { close(is); } }
public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); }
public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); }
return reader.getEncoding();
return reader.getEncoding();
/** * Creates a new dialog that will handle the wait while we're finding out what tables, views etc we can reach in the * database. */ public TextFileCSVImportProgressDialog( Shell shell, InputFileMetaInterface meta, TransMeta transMeta, InputStreamReader reader, int samples, boolean replaceMeta ) { this.shell = shell; this.meta = meta; this.reader = reader; this.samples = samples; this.replaceMeta = replaceMeta; this.transMeta = transMeta; message = null; debug = "init"; rownumber = 1L; this.log = new LogChannel( transMeta ); this.encodingType = EncodingType.guessEncodingType( reader.getEncoding() ); }
/** * Creates a new dialog that will handle the wait while we're finding out what tables, views etc we can reach in the * database. */ public TextFileCSVImportProgressDialog( Shell shell, TextFileInputMeta meta, TransMeta transMeta, InputStreamReader reader, int samples, boolean replaceMeta ) { this.shell = shell; this.meta = meta; this.reader = reader; this.samples = samples; this.replaceMeta = replaceMeta; this.transMeta = transMeta; message = null; debug = "init"; rownumber = 1L; this.log = new LogChannel( transMeta ); this.encodingType = EncodingType.guessEncodingType( reader.getEncoding() ); }
@Override public void analyze(Document doc, StreamSource src, Writer xrefOut) throws IOException { try (Reader r = getReader(src.getStream())) { encoding = ((InputStreamReader) r).getEncoding(); StringBuilder sb = new StringBuilder(); int c; while ((c = r.read()) != -1) { sb.append((char) c); } contents = sb.toString(); } }
public TextFileInputReader( IBaseFileInputStepControl step, TextFileInputMeta meta, TextFileInputData data, FileObject file, LogChannelInterface log ) throws Exception { this.step = step; this.meta = meta; this.data = data; this.log = log; CompressionProvider provider = CompressionProviderFactory.getInstance().getCompressionProviderByName( meta.content.fileCompression ); if ( log.isDetailed() ) { log.logDetailed( "This is a compressed file being handled by the " + provider.getName() + " provider" ); } in = provider.createInputStream( KettleVFS.getInputStream( file ) ); in.nextEntry(); BufferedInputStream inStream = new BufferedInputStream( in, BUFFER_SIZE_INPUT_STREAM ); BOMDetector bom = new BOMDetector( inStream ); if ( bom.bomExist() ) { // if BOM exist, use it instead defined charset isr = new InputStreamReader( inStream, bom.getCharset() ); } else if ( meta.getEncoding() != null && meta.getEncoding().length() > 0 ) { isr = new InputStreamReader( inStream, meta.getEncoding() ); } else { isr = new InputStreamReader( inStream ); } String encoding = isr.getEncoding(); data.encodingType = EncodingType.guessEncodingType( encoding ); readInitial(); }
final String enclosure = getTransMeta().environmentSubstitute( meta.getEnclosure() ); final EncodingType encodingType = EncodingType.guessEncodingType( reader.getEncoding() );
reader = new InputStreamReader( f ); EncodingType encodingType = EncodingType.guessEncodingType( reader.getEncoding() );
String[] readFieldNamesFromFile( String fileName, CsvInputMeta csvInputMeta ) throws KettleException { String delimiter = environmentSubstitute( csvInputMeta.getDelimiter() ); String enclosure = environmentSubstitute( csvInputMeta.getEnclosure() ); String realEncoding = environmentSubstitute( csvInputMeta.getEncoding() ); try ( FileObject fileObject = KettleVFS.getFileObject( fileName, getTransMeta() ); BOMInputStream inputStream = new BOMInputStream( KettleVFS.getInputStream( fileObject ), ByteOrderMark.UTF_8, ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_16BE ) ) { InputStreamReader reader = null; if ( Utils.isEmpty( realEncoding ) ) { reader = new InputStreamReader( inputStream ); } else { reader = new InputStreamReader( inputStream, realEncoding ); } EncodingType encodingType = EncodingType.guessEncodingType( reader.getEncoding() ); String line = TextFileInput.getLine( log, reader, encodingType, TextFileInputMeta.FILE_FORMAT_UNIX, new StringBuilder( 1000 ) ); String[] fieldNames = CsvInput.guessStringsFromLine( log, line, delimiter, enclosure, csvInputMeta.getEscapeCharacter() ); if ( !Utils.isEmpty( csvInputMeta.getEnclosure() ) ) { removeEnclosure( fieldNames, csvInputMeta.getEnclosure() ); } trimFieldNames( fieldNames ); return fieldNames; } catch ( IOException e ) { throw new KettleFileException( BaseMessages.getString( PKG, "CsvInput.Exception.CreateFieldMappingError" ), e ); } }
reader = new InputStreamReader( f ); EncodingType encodingType = EncodingType.guessEncodingType( reader.getEncoding() );
EncodingType encodingType = EncodingType.guessEncodingType( reader.getEncoding() );
String encoding = data.isr.getEncoding(); data.encodingType = EncodingType.guessEncodingType( encoding );
EncodingType encodingType = EncodingType.guessEncodingType( reader.getEncoding() );