Package org.apache.manifoldcf.core.common

Examples of org.apache.manifoldcf.core.common.Base64


            pw.print("\"_content_type\" : "+jsonStringEscape(contentType)+",");
          String fileName = document.getFileName();
          if (fileName != null)
            pw.print("\"_name\" : "+jsonStringEscape(fileName)+",");
          pw.print(" \"content\" : \"");
          Base64 base64 = new Base64();
          base64.encodeStream(inputStream, pw);
          pw.print("\"}");
        }
       
        pw.print("}");
      } catch (ManifoldCFException e)
View Full Code Here


                  // Apply ACL if present
                  if (aclXmlString.length() > 0)
                  {

                    String encodedACL = new Base64().encodeByteArray(aclXmlString.getBytes("UTF-8"));

                    // Break into chunks - 4K each - 'cause otherwise we blow up the ingester.
                    int index = 0;
                    while (true)
                    {
                      if (index + HEADER_CHUNK >= encodedACL.length())
                      {
                        tmp = ("Document-ACL: " + encodedACL.substring(index) + "\r\n").getBytes("UTF-8");
                        out.write(tmp, 0, tmp.length);
                        break;
                      }
                      tmp = ("Document-ACL: " + encodedACL.substring(index,index + HEADER_CHUNK) + "\r\n").getBytes("UTF-8");
                      out.write(tmp, 0, tmp.length);
                      index += HEADER_CHUNK;
                    }
                  }

                  // Do the collections
                  if (collections != null)
                  {
                    int index = 0;
                    while (index < collections.length)
                    {
                      String collectionName = collections[index++];
                      String encodedValue = metadataEncode(collectionName);
                      //System.out.println("collection metadata: collection_name = '"+encodedValue+"'");
                      tmp = ("Document-Metadata: collection_name="+encodedValue+"\r\n").getBytes("UTF-8");
                      out.write(tmp, 0, tmp.length);
                    }
                  }

                  // Do the document template
                  if (documentTemplate != null && documentTemplate.length() > 0)
                  {
                    String encodedTemplate = new Base64().encodeByteArray(documentTemplate.getBytes("UTF-8"));
                    // Break into chunks - 4K each - 'cause otherwise we blow up the ingester.
                    int index = 0;
                    while (true)
                    {
                      if (index + HEADER_CHUNK >= encodedTemplate.length())
View Full Code Here

        pw.print(documentURI);
        pw.println("</value></field>");
        pw.print("<binary fileName=\"");
        pw.print(fileName);
        pw.println("\">");
        Base64 base64 = new Base64();
        base64.encodeStream(inputStream, pw);
        pw.println("</binary></document>");
        pw.println("</index>");
      } catch (ManifoldCFException e) {
        throw new IOException(e.getMessage());
      } finally {
View Full Code Here

          if(existentFields){
            pw.print(",");
          }
          pw.print("\"type\" : \"attachment\",");
          pw.print("\"file\" : \"");
          Base64 base64 = new Base64();
          base64.encodeStream(inputStream, pw);
          pw.print("\"");
        }
       
        pw.print("}");
      } catch (ManifoldCFException e)
View Full Code Here

        pw.print(documentURI);
        pw.println("</value></field>");
        pw.print("<binary fileName=\"");
        pw.print(fileName);
        pw.println("\">");
        Base64 base64 = new Base64();
        base64.encodeStream(inputStream, pw);
        pw.println("</binary></document>");
        pw.println("</index>");
      } catch (ManifoldCFException e) {
        throw new IOException(e.getMessage());
      } finally {
View Full Code Here

              try
              {
                Writer osw = new OutputStreamWriter(fos,"utf-8");
                try
                {
                  String certBase64 = new Base64().encodeByteArray(certData);
                  osw.write("-----BEGIN CERTIFICATE-----\n");
                  int index = 0;
                  while (true)
                  {
                    if (certBase64.length() - index > 64)
View Full Code Here

            pw.print("\"_content_type\" : "+jsonStringEscape(contentType)+",");
          String fileName = document.getFileName();
          if (fileName != null)
            pw.print("\"_name\" : "+jsonStringEscape(fileName)+",");
          pw.print("\"file\" : \"");
          Base64 base64 = new Base64();
          base64.encodeStream(inputStream, pw);
          pw.print("\"");
        }
       
        pw.print("}");
      } catch (ManifoldCFException e)
View Full Code Here

                  // Apply ACL if present
                  if (aclXmlString.length() > 0)
                  {

                    String encodedACL = new Base64().encodeByteArray(aclXmlString.getBytes(StandardCharsets.UTF_8));

                    // Break into chunks - 4K each - 'cause otherwise we blow up the ingester.
                    int index = 0;
                    while (true)
                    {
                      if (index + HEADER_CHUNK >= encodedACL.length())
                      {
                        tmp = ("Document-ACL: " + encodedACL.substring(index) + "\r\n").getBytes(StandardCharsets.UTF_8);
                        out.write(tmp, 0, tmp.length);
                        break;
                      }
                      tmp = ("Document-ACL: " + encodedACL.substring(index,index + HEADER_CHUNK) + "\r\n").getBytes(StandardCharsets.UTF_8);
                      out.write(tmp, 0, tmp.length);
                      index += HEADER_CHUNK;
                    }
                  }

                  // Do the collections
                  if (collections != null)
                  {
                    int index = 0;
                    while (index < collections.length)
                    {
                      String collectionName = collections[index++];
                      String encodedValue = metadataEncode(collectionName);
                      //System.out.println("collection metadata: collection_name = '"+encodedValue+"'");
                      tmp = ("Document-Metadata: collection_name="+encodedValue+"\r\n").getBytes(StandardCharsets.UTF_8);
                      out.write(tmp, 0, tmp.length);
                    }
                  }

                  // Do the document template
                  if (documentTemplate != null && documentTemplate.length() > 0)
                  {
                    String encodedTemplate = new Base64().encodeByteArray(documentTemplate.getBytes(StandardCharsets.UTF_8));
                    // Break into chunks - 4K each - 'cause otherwise we blow up the ingester.
                    int index = 0;
                    while (true)
                    {
                      if (index + HEADER_CHUNK >= encodedTemplate.length())
View Full Code Here

            pw.print("\"_content_type\" : "+jsonStringEscape(contentType)+",");
          String fileName = document.getFileName();
          if (fileName != null)
            pw.print("\"_name\" : "+jsonStringEscape(fileName)+",");
          pw.print(" \"content\" : \"");
          Base64 base64 = new Base64();
          base64.encodeStream(inputStream, pw);
          pw.print("\"}");
        }
       
        pw.print("}");
      } catch (ManifoldCFException e)
View Full Code Here

          if(existentFields){
            pw.print(",");
          }
          pw.print("\"type\" : \"attachment\",");
          pw.print("\"file\" : \"");
          Base64 base64 = new Base64();
          base64.encodeStream(inputStream, pw);
          pw.print("\"");
        }
       
        pw.print("}");
      } catch (ManifoldCFException e)
View Full Code Here

TOP

Related Classes of org.apache.manifoldcf.core.common.Base64

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.