/** * Constructs a SQLXML from bytes that are already encoded in {@link Streamable#ENCODING} * @param bytes */ public SQLXMLImpl(final byte[] bytes) { super(new InputStreamFactory() { @Override public InputStream getInputStream() throws IOException { return new ByteArrayInputStream(bytes); } @Override public StorageMode getStorageMode() { return StorageMode.MEMORY; } @Override public long getLength() { return bytes.length; } }); setEncoding(Streamable.ENCODING); }
/** * Constructs a SQLXML from bytes that are already encoded in {@link Streamable#ENCODING} * @param bytes */ public SQLXMLImpl(final byte[] bytes) { super(new InputStreamFactory() { @Override public InputStream getInputStream() throws IOException { return new ByteArrayInputStream(bytes); } @Override public StorageMode getStorageMode() { return StorageMode.MEMORY; } @Override public long getLength() { return bytes.length; } }); setEncoding(Streamable.ENCODING); }
public DocumentInProgress(FileStore store, String encoding) throws TeiidComponentException{ final FileStoreInputStreamFactory fsisf = new FileStoreInputStreamFactory(store, encoding); this.xml = new SQLXMLImpl(fsisf); this.xml.setEncoding(encoding); SAXTransformerFactory factory = new TransformerFactoryImpl(); try { //SAX2.0 ContentHandler handler = factory.newTransformerHandler(); handler.setResult(new StreamResult(fsisf.getOuputStream())); } catch (Exception e) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30204, e); } transformer = handler.getTransformer(); transformer.setOutputProperty(OutputKeys.ENCODING, encoding); }
@Override public Charset getCharset() { Charset cs = super.getCharset(); if (cs != null) { return cs; } String enc = null; try { enc = XMLType.getEncoding(this.getBinaryStream()); } catch (SQLException e) { } if (enc != null) { setEncoding(enc); } else { super.setCharset(Streamable.CHARSET); } return super.getCharset(); }
@Override public Charset getCharset() { Charset cs = super.getCharset(); if (cs != null) { return cs; } String enc = null; try { enc = XMLType.getEncoding(this.getBinaryStream()); } catch (SQLException e) { } if (enc != null) { setEncoding(enc); } else { super.setCharset(Streamable.CHARSET); } return super.getCharset(); }
xml.setEncoding(charset(part));
xml.setEncoding(charset(part));
XMLType val = (XMLType)currentValue; SQLXMLImpl impl = new SQLXMLImpl(createInputStreamFactory(val)); impl.setEncoding(val.getEncoding()); return impl;
XMLType val = (XMLType)currentValue; SQLXMLImpl impl = new SQLXMLImpl(createInputStreamFactory(val)); impl.setEncoding(val.getEncoding()); return impl;