data = ((Clob) data).getCharacterStream(); return IOUtils.readStringAndClose((Reader) data, -1); } catch (IOException e) { throw DbException.toSQLException(e);
@Override public String getString() { int len = precision > Integer.MAX_VALUE || precision == 0 ? Integer.MAX_VALUE : (int) precision; try { if (type == Value.CLOB) { if (small != null) { return new String(small, StandardCharsets.UTF_8); } return IOUtils.readStringAndClose(getReader(), len); } byte[] buff; if (small != null) { buff = small; } else { buff = IOUtils.readBytesAndClose(getInputStream(), len); } return StringUtils.convertBytesToHex(buff); } catch (IOException e) { throw DbException.convertIOException(e, fileName); } }
try { if (handler == null) { String s = IOUtils.readStringAndClose(in, (int) length); return createSmallLob(Value.CLOB, s.getBytes(StandardCharsets.UTF_8)); char[] buff; if (len >= Integer.MAX_VALUE) { String data = IOUtils.readStringAndClose(in, -1); buff = data.toCharArray(); len = buff.length;
char[] buff; if (len >= Integer.MAX_VALUE) { String data = IOUtils.readStringAndClose(reader, -1); buff = data.toCharArray(); len = buff.length;
@Override public String getString() { int len = precision > Integer.MAX_VALUE || precision == 0 ? Integer.MAX_VALUE : (int) precision; try { if (type == Value.CLOB) { if (small != null) { return new String(small, StandardCharsets.UTF_8); } return IOUtils.readStringAndClose(getReader(), len); } byte[] buff; if (small != null) { buff = small; } else { buff = IOUtils.readBytesAndClose(getInputStream(), len); } return StringUtils.convertBytesToHex(buff); } catch (IOException e) { throw DbException.convertIOException(e, toString()); } }
resultSet.getString("message")); assertEquals("The exception column is not correct (1).", stackTrace, IOUtils.readStringAndClose(resultSet.getNClob("exception").getCharacterStream(), -1));
try { int p = MathUtils.convertLongToInt(precision); String s = IOUtils.readStringAndClose(getReader(), p); byte[] data = s.getBytes(StandardCharsets.UTF_8); lob = ValueLobDb.createSmallLob(type, data, s.length());
resultSet.getString("message")); assertEquals("The exception column is not correct (1).", Strings.EMPTY, IOUtils.readStringAndClose(resultSet.getNClob("exception").getCharacterStream(), -1)); resultSet.getString("message")); assertEquals("The exception column is not correct (2).", stackTrace, IOUtils.readStringAndClose(resultSet.getNClob("exception").getCharacterStream(), -1));
@Override public void afterPropertiesSet() throws Exception { _messageTemplate = IOUtils.readStringAndClose(new InputStreamReader(_messageTemplateResource.getInputStream()), (int) _messageTemplateResource.contentLength()); }
public static void importModel(RepositoryService repositoryService, File modelFile) throws IOException, XMLStreamException { InputStreamReader reader = new InputStreamReader(new FileInputStream(modelFile), "utf-8"); String fileContent = IOUtils.readStringAndClose(reader, (int) modelFile.length()); BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(new StringStreamSourceEx(fileContent), false, false); String processName = bpmnModel.getMainProcess().getName(); if (processName == null || processName.isEmpty()) { processName = bpmnModel.getMainProcess().getId(); } Model modelData = repositoryService.newModel(); ObjectNode modelObjectNode = new ObjectMapper().createObjectNode(); modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processName); modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1); modelData.setMetaInfo(modelObjectNode.toString()); modelData.setName(processName); modelData.setKey(modelFile.getName()); repositoryService.saveModel(modelData); repositoryService.addModelEditorSource(modelData.getId(), fileContent.getBytes("utf-8")); Logger.getLogger(ModelUtils.class) .info(String.format("importing model file: %s", modelFile.getCanonicalPath())); } }
public static String readToString(File file) { try { return IOUtils.readStringAndClose(new FileReader(file), -1); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
public static String toString(InputStream input) { try { return IOUtils.readStringAndClose(new InputStreamReader(input), -1); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
private String readSqlFrom(Resource resource) throws IOException { return readStringAndClose(getBufferedReader(resource.getInputStream()), -1); }
@Override public String getString() { int len = precision > Integer.MAX_VALUE || precision == 0 ? Integer.MAX_VALUE : (int) precision; try { if (type == Value.CLOB) { if (small != null) { return new String(small, Constants.UTF8); } return IOUtils.readStringAndClose(getReader(), len); } byte[] buff; if (small != null) { buff = small; } else { buff = IOUtils.readBytesAndClose(getInputStream(), len); } return StringUtils.convertBytesToHex(buff); } catch (IOException e) { throw DbException.convertIOException(e, fileName); } }
@Override public String getString() { int len = precision > Integer.MAX_VALUE || precision == 0 ? Integer.MAX_VALUE : (int) precision; try { if (type == Value.CLOB) { if (small != null) { return new String(small, Constants.UTF8); } return IOUtils.readStringAndClose(getReader(), len); } byte[] buff; if (small != null) { buff = small; } else { buff = IOUtils.readBytesAndClose(getInputStream(), len); } return StringUtils.convertBytesToHex(buff); } catch (IOException e) { throw DbException.convertIOException(e, fileName); } }
@Override public String getString() { int len = precision > Integer.MAX_VALUE || precision == 0 ? Integer.MAX_VALUE : (int) precision; try { if (type == Value.CLOB) { if (small != null) { return new String(small, Constants.UTF8); } return IOUtils.readStringAndClose(getReader(), len); } byte[] buff; if (small != null) { buff = small; } else { buff = IOUtils.readBytesAndClose(getInputStream(), len); } return StringUtils.convertBytesToHex(buff); } catch (IOException e) { throw DbException.convertIOException(e, toString()); } }
@Override public String getString() { int len = precision > Integer.MAX_VALUE || precision == 0 ? Integer.MAX_VALUE : (int) precision; try { if (type == Value.CLOB) { if (small != null) { return new String(small, Constants.UTF8); } return IOUtils.readStringAndClose(getReader(), len); } byte[] buff; if (small != null) { buff = small; } else { buff = IOUtils.readBytesAndClose(getInputStream(), len); } return StringUtils.convertBytesToHex(buff); } catch (IOException e) { throw DbException.convertIOException(e, toString()); } }
try { int p = MathUtils.convertLongToInt(precision); String s = IOUtils.readStringAndClose(getReader(), p); byte[] data = s.getBytes(Constants.UTF8); lob = ValueLobDb.createSmallLob(type, data, s.length());
try { int p = MathUtils.convertLongToInt(precision); String s = IOUtils.readStringAndClose(getReader(), p); byte[] data = s.getBytes(Constants.UTF8); lob = ValueLobDb.createSmallLob(type, data, s.length());
public String getString() { int len = precision > Integer.MAX_VALUE || precision == 0 ? Integer.MAX_VALUE : (int) precision; try { if (type == Value.CLOB) { if (small != null) { return StringUtils.utf8Decode(small); } return IOUtils.readStringAndClose(getReader(), len); } else { byte[] buff; if (small != null) { buff = small; } else { buff = IOUtils.readBytesAndClose(getInputStream(), len); } return ByteUtils.convertBytesToString(buff); } } catch (IOException e) { throw Message.convertToInternal(Message.convertIOException(e, fileName)); } catch (SQLException e) { throw Message.convertToInternal(e); } }