private void writeLine(OutputStream out, String s) throws IOException { out.write(IOUtils.toUTF8Bytes(s == null ? CRLF : s + CRLF)); } }
private void writeLine(OutputStream out, String s) throws IOException { out.write(IOUtils.toUTF8Bytes(s == null ? CRLF : s + CRLF)); } }
/** * Transforms the transaction into a cookie name. */ public String getCookieName(String token) { if (token == null || token.length() == 0) { return "cmis%"; } return "cmis_" + Base64.encodeBytes(IOUtils.toUTF8Bytes(token)).replace('=', '%'); }
private ContentStream getContentStream() { byte[] contentBytes = IOUtils.toUTF8Bytes("some content"); return new ContentStreamImpl("content.txt", BigInteger.valueOf(contentBytes.length), "text/plain", new ByteArrayInputStream(contentBytes)); } }
/** * Generates a valid Atom id. */ public String generateAtomId(String input) { if (input == null) { return ID_DUMMY; } return ID_PREFIX + Base64.encodeBytes(IOUtils.toUTF8Bytes(input)); }
buf.append(charset); buf.append("''"); // no language byte[] bytes = IOUtils.toUTF8Bytes(value);
buf.append(charset); buf.append("''"); // no language byte[] bytes = IOUtils.toUTF8Bytes(value);
/** * Creates a content stream object from a string. * * @param filename * name of the content stream * @param content * the content string * @param mimetype * content MIME type * * @return a {@link MutableContentStream} object */ public static MutableContentStream createTextContentStream(String filename, String content, String mimetype) { byte[] contentBytes = IOUtils.toUTF8Bytes(content); return createByteArrayContentStream(filename, contentBytes, checkMIMEType(mimetype)); }
inXmlOrJsonBody = true; isXml = line.startsWith("<?xml"); byte[] lienBytes = IOUtils.toUTF8Bytes(line); xmlBodyBuffer.write(lienBytes, 0, lienBytes.length); while (inXmlOrJsonBody) {
/** * Creates a content stream object from a string. * * @param filename * name of the content stream * @param content * the content string * @param mimetype * content MIME type * * @return a {@link MutableContentStream} object */ public static MutableContentStream createTextContentStream(String filename, String content, String mimetype) { byte[] contentBytes = IOUtils.toUTF8Bytes(content); return createByteArrayContentStream(filename, contentBytes, checkMIMEType(mimetype)); }
bytes = IOUtils.toUTF8Bytes(s);
public ContentStream createContentLoremIpsumText() { ContentStreamImpl content = new ContentStreamImpl(); content.setFileName("data.txt"); content.setMimeType("text/plain"); int len = fContentSizeInK * 1024; // size of document in K LoremIpsum ipsum = new LoremIpsum(); String text = ipsum.generateParagraphsPlainText(len, 80, true); content.setStream(new ByteArrayInputStream(IOUtils.toUTF8Bytes(text))); return content; }
public ContentStream createContentLoremIpsumHtml() { ContentStreamImpl content = new ContentStreamImpl(); content.setFileName("data.html"); content.setMimeType("text/html"); int len = fContentSizeInK * KILO; // size of document in K LoremIpsum ipsum = new LoremIpsum(); String text = ipsum.generateParagraphsFullHtml(len, true); content.setStream(new ByteArrayInputStream(IOUtils.toUTF8Bytes(text))); return content; }
out1.write(IOUtils.toUTF8Bytes("line 1\n")); out1.write(IOUtils.toUTF8Bytes("line 2\n")); out1.flush(); out1.write(IOUtils.toUTF8Bytes("line 3\n")); out1.close(); out2.write(IOUtils.toUTF8Bytes("line 4\n")); out2.write(IOUtils.toUTF8Bytes("line 5\n")); out2.flush(); out2.write(IOUtils.toUTF8Bytes("line 6\n")); out2.close();
properties.put(PropertyIds.OBJECT_TYPE_ID, getFolderTestTypeId()); byte[] contentBytes = IOUtils.toUTF8Bytes("nothing"); ContentStream contentStream = new ContentStreamImpl("never.txt", BigInteger.valueOf(contentBytes.length), "text/plain", new ByteArrayInputStream(contentBytes));
byte[] amp = IOUtils.toUTF8Bytes("&"); out.write(IOUtils.toUTF8Bytes(param.getKey() + "=" + URLEncoder.encode(param.getValue(), IOUtils.UTF8)));
byte[] amp = IOUtils.toUTF8Bytes("&"); out.write(IOUtils.toUTF8Bytes(param.getKey() + "=" + URLEncoder.encode(param.getValue(), IOUtils.UTF8)));
String s = parser.getText(); if (s != null) { byte[] bytes = IOUtils.toUTF8Bytes(s); bufferStream.write(bytes); cappedStream.deductBytes(bytes.length);
private Document createVersion(Session session, Document doc, String content, int version) { CmisTestResult f; // check out ObjectId pwcId = doc.checkOut(); Document pwc = (Document) session.getObject(pwcId, SELECT_ALL_NO_CACHE_OC); addResult(checkObject(session, pwc, getAllProperties(pwc), "PWC " + version + " compliance")); // check in byte[] contentBytes = IOUtils.toUTF8Bytes(content); ContentStream contentStream = new ContentStreamImpl(doc.getName(), BigInteger.valueOf(contentBytes.length), "text/plain", new ByteArrayInputStream(contentBytes)); ObjectId newVersionId = pwc.checkIn(true, null, contentStream, "test version " + version); IOUtils.closeQuietly(contentStream); Document newVersion = (Document) session.getObject(newVersionId, SELECT_ALL_NO_CACHE_OC); addResult(checkObject(session, newVersion, getAllProperties(newVersion), "Version " + version + " compliance")); // check version history List<Document> versions = doc.getAllVersions(); f = createResult(FAILURE, "Version series should have " + version + " versions but has " + versions.size() + "!"); addResult(assertEquals(version, versions.size(), null, f)); if (!versions.isEmpty()) { f = createResult(FAILURE, "Newly created version " + version + " is not the latest version!"); addResult(assertEquals(newVersion.getId(), versions.get(0).getId(), null, f)); if (versions.size() > 1) { f = createResult(FAILURE, "The previous version of version " + version + " is not the document it has been created from!"); addResult(assertEquals(doc.getId(), versions.get(1).getId(), null, f)); } } return newVersion; }
byte[] contentBytes = IOUtils.toUTF8Bytes("New content"); ContentStream contentStream = new ContentStreamImpl("content2.txt", BigInteger.valueOf(contentBytes.length), "text/plain", new ByteArrayInputStream(contentBytes));