Search in sources :

Example 96 with StringValue

use of org.exist.xquery.value.StringValue in project exist by eXist-db.

the class ZipEntryFunctions method extractStringEntry.

private StringValue extractStringEntry(final ZipInputStream zis) throws XPathException, IOException {
    final char[] buf = new char[4096];
    final StringBuilder builder = new StringBuilder();
    int read = -1;
    try (final Reader reader = new InputStreamReader(zis, UTF_8)) {
        while ((read = reader.read(buf)) > -1) {
            builder.append(buf, 0, read);
        }
    }
    return new StringValue(builder.toString());
}
Also used : InputStreamReader(java.io.InputStreamReader) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) StringValue(org.exist.xquery.value.StringValue)

Aggregations

StringValue (org.exist.xquery.value.StringValue)96 Sequence (org.exist.xquery.value.Sequence)49 XPathException (org.exist.xquery.XPathException)40 ValueSequence (org.exist.xquery.value.ValueSequence)27 IOException (java.io.IOException)11 PermissionDeniedException (org.exist.security.PermissionDeniedException)10 Item (org.exist.xquery.value.Item)10 XQueryContext (org.exist.xquery.XQueryContext)8 Txn (org.exist.storage.txn.Txn)7 AnyURIValue (org.exist.xquery.value.AnyURIValue)7 QName (org.exist.dom.QName)6 LockException (org.exist.util.LockException)6 NodeValue (org.exist.xquery.value.NodeValue)6 Path (java.nio.file.Path)5 EXistException (org.exist.EXistException)5 TriggerException (org.exist.collections.triggers.TriggerException)5 DocumentImpl (org.exist.dom.persistent.DocumentImpl)5 StoredNode (org.exist.dom.persistent.StoredNode)5 NotificationService (org.exist.storage.NotificationService)5 MimeType (org.exist.util.MimeType)5