Package net.yacy.kelondro.io

Examples of net.yacy.kelondro.io.CharBuffer


    }

    public boolean checkSignature() {
        if(this.releaseFile != null) {
            try {
                final CharBuffer signBuffer = new CharBuffer(getSignatureFile());
                final byte[] signByteBuffer = Base64Order.standardCoder.decode(signBuffer.toString().trim());
                final CryptoLib cl = new CryptoLib();
                for(final yacyUpdateLocation updateLocation : latestReleaseLocations) {
                    try {
                        if(cl.verifySignature(updateLocation.getPublicKey(),
                            new FileInputStream(this.releaseFile), signByteBuffer)) {
View Full Code Here


            final String dc_creator,
            final String dc_subject,
            final String dc_publisher,
            final float lat,
            final float lon) {
        final CharBuffer s = new CharBuffer(360);
        s.append(url.toNormalform(false, true)).append(10);
        s.append(dc_title).append(10);
        s.append(dc_creator.length() > 80 ? dc_creator.substring(0, 80) : dc_creator).append(10);
        s.append(dc_subject.length() > 120 ? dc_subject.substring(0, 120) : dc_subject).append(10);
        s.append(dc_publisher).append(10);
        if (lon == 0.0f && lat == 0.0f) s.append(10); else s.append(Float.toString(lat)).append(',').append(Float.toString(lon)).append(10);
    return UTF8.getBytes(s.toString());
    }
View Full Code Here

        this.headlines = new ArrayList[6];
        for (int i = 0; i < this.headlines.length; i++) this.headlines[i] = new ArrayList<String>();
        this.bold = new ClusteredScoreMap<String>();
        this.italic = new ClusteredScoreMap<String>();
        this.li = new ArrayList<String>();
        this.content = new CharBuffer(1024);
        this.htmlFilterEventListeners = new EventListenerList();
        this.lon = 0.0f;
        this.lat = 0.0f;
        this.evaluationScores.match(Element.url, root.toNormalform(false, false));
        this.canonical = null;
View Full Code Here

            final boolean passbyIfBinarySuspect
    ) {
        this.outStream     = outStream;
        this.scraper       = scraper;
        this.transformer   = transformer;
        this.buffer        = new CharBuffer(1024);
        this.filterTag     = null;
        this.filterOpts    = null;
        this.filterCont    = null;
        this.inSingleQuote = false;
        this.inDoubleQuote = false;
View Full Code Here

            this.out = new OutputStreamWriter(this.outStream,(charSet == null)?Charset.defaultCharset():charSet);
        }
    }

    public static char[] genTag0raw(final String tagname, final boolean opening, final char[] tagopts) {
            final CharBuffer bb = new CharBuffer(tagname.length() + tagopts.length + 3);
            bb.append((int)'<');
            if (!opening) {
                bb.append((int)'/');
            }
            bb.append(tagname);
            if (tagopts.length > 0) {
//              if (tagopts[0] == (byte) 32)
                bb.append(tagopts);
//              else bb.append((byte) 32).append(tagopts);
            }
            bb.append((int)'>');
            final char[] result = bb.getChars();
            try {
        bb.close();
      } catch (final IOException e) {
          Log.logException(e);
      }
            return result;
    }
View Full Code Here

      }
            return result;
    }

    public static char[] genTag1raw(final String tagname, final char[] tagopts, final char[] text) {
            final CharBuffer bb = new CharBuffer(2 * tagname.length() + tagopts.length + text.length + 5);
            bb.append((int)'<').append(tagname);
            if (tagopts.length > 0) {
//              if (tagopts[0] == (byte) 32)
                bb.append(tagopts);
//              else bb.append((byte) 32).append(tagopts);
            }
            bb.append((int)'>');
            bb.append(text);
            bb.append((int)'<').append((int)'/').append(tagname).append((int)'>');
            final char[] result = bb.getChars();
            try {
        bb.close();
      } catch (final IOException e) {
          Log.logException(e);
      }
            return result;
    }
View Full Code Here

            return result;
    }

    public static char[] genTag0(final String tagname, final Properties tagopts, final char quotechar) {
            final char[] tagoptsx = (tagopts.isEmpty()) ? null : genOpts(tagopts, quotechar);
            final CharBuffer bb = new CharBuffer(tagname.length() + ((tagoptsx == null) ? 0 : (tagoptsx.length + 1)) + tagname.length() + 2);
            bb.append((int)'<').append(tagname);
            if (tagoptsx != null) {
                bb.append(32);
                bb.append(tagoptsx);
            }
            bb.append((int)'>');
            final char[] result = bb.getChars();
            try {
        bb.close();
      } catch (final IOException e) {
          Log.logException(e);
      }
            return result;
    }
View Full Code Here

            return result;
    }

    public static char[] genTag1(final String tagname, final Properties tagopts, final char[] text, final char quotechar) {
            final char[] gt0 = genTag0(tagname, tagopts, quotechar);
            final CharBuffer cb = new CharBuffer(gt0, gt0.length + text.length + tagname.length() + 3);
            cb.append(text).append((int)'<').append((int)'/').append(tagname).append((int)'>');
            final char[] result = cb.getChars();
            try {
        cb.close();
      } catch (final IOException e) {
          Log.logException(e);
      }
            return result;
    }
View Full Code Here

    }

    // a helper method for pretty-printing of properties for html tags
    public static char[] genOpts(final Properties prop, final char quotechar) {
            final Enumeration<?> e = prop.propertyNames();
            final CharBuffer bb = new CharBuffer(prop.size() * 40);
            String key;
            while (e.hasMoreElements()) {
                key = (String) e.nextElement();
                bb.append(32).append(key).append((int)'=').append((int)quotechar);
                bb.append(prop.getProperty(key));
                bb.append((int)quotechar);
            }
            final char[] result;
            if (bb.length() > 0)
              result = bb.getChars(1);
            else
              result = bb.getChars();
            try {
        bb.close();
      } catch (final IOException ex) {
          Log.logException(ex);
      }
            return result;
    }
View Full Code Here

            // we have a new tag
            if (opening) {
                if ((this.scraper != null) && (this.scraper.isTag0(tag))) {
                    // this single tag is collected at once here
                  final CharBuffer charBuffer = new CharBuffer(content);
                    this.scraper.scrapeTag0(tag, charBuffer.propParser());
                    try {
            charBuffer.close();
          } catch (final IOException e) {
            // TODO Auto-generated catch block
              Log.logException(e);
          }
                }
                if ((this.transformer != null) && (this.transformer.isTag0(tag))) {
                    // this single tag is collected at once here
                  final CharBuffer scb = new CharBuffer(content);
                  try {
                    return this.transformer.transformTag0(tag, scb.propParser(), quotechar);
                  } finally {
                    try {
              scb.close();
            } catch (final IOException e) {
                Log.logException(e);
            }
                  }
                } else if (((this.scraper != null) && (this.scraper.isTag1(tag))) ||
                           ((this.transformer != null) && (this.transformer.isTag1(tag)))) {
                    // ok, start collecting
                    this.filterTag = tag;
                    final CharBuffer scb = new CharBuffer(content);
                    this.filterOpts = scb.propParser();
                    try {
            scb.close();
          } catch (final IOException e) {
              Log.logException(e);
          }
                    if (this.filterCont == null) this.filterCont = new CharBuffer(Math.max(100, content.length)); else this.filterCont.reset();
                    return new char[0];
                } else {
                     // we ignore that thing and return it again
                     return genTag0raw(tag, true, content);
                }
View Full Code Here

TOP

Related Classes of net.yacy.kelondro.io.CharBuffer

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.