Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.Text.find()


    assertThat(t.getLength(), is(10));
   
    assertThat(t.find("\u0041"), is(0));
    assertThat(t.find("\u00DF"), is(1));
    assertThat(t.find("\u6771"), is(3));
    assertThat(t.find("\uD801\uDC00"), is(6));

    assertThat(t.charAt(0), is(0x0041));
    assertThat(t.charAt(1), is(0x00DF));
    assertThat(t.charAt(3), is(0x6771));
    assertThat(t.charAt(6), is(0x10400));
View Full Code Here


    LineReader in = null;
    try {
      in = new LineReader(fs.open(userloc));
      while (in.readLine(rawUgi) > 0) {//line is of the form username[,group]*
        // e is end position of user name in this line
        int e = rawUgi.find(",");
        if (rawUgi.getLength() == 0 || e == 0) {
          throw new IOException("Missing username: " + rawUgi);
        }
        if (e == -1) {
          e = rawUgi.getLength();
View Full Code Here

    LineReader in = null;
    try {
      final ArrayList<String> groups = new ArrayList();
      in = new LineReader(fs.open(userloc));
      while (in.readLine(rawUgi) > 0) {
        int e = rawUgi.find(",");
        if (e <= 0) {
          throw new IOException("Missing username: " + rawUgi);
        }
        final String username = Text.decode(rawUgi.getBytes(), 0, e);
        int s = e;
View Full Code Here

        if (e <= 0) {
          throw new IOException("Missing username: " + rawUgi);
        }
        final String username = Text.decode(rawUgi.getBytes(), 0, e);
        int s = e;
        while ((e = rawUgi.find(",", ++s)) != -1) {
          groups.add(Text.decode(rawUgi.getBytes(), s, e - s));
          s = e;
        }
        groups.add(Text.decode(rawUgi.getBytes(), s, rawUgi.getLength() - s));
        if (groups.size() == 0) {
View Full Code Here

    LineReader in = null;
    try {
      in = new LineReader(fs.open(userloc));
      while (in.readLine(rawUgi) > 0) {//line is of the form username[,group]*
        // e is end position of user name in this line
        int e = rawUgi.find(",");
        if (rawUgi.getLength() == 0 || e == 0) {
          throw new IOException("Missing username: " + rawUgi);
        }
        if (e == -1) {
          e = rawUgi.getLength();
View Full Code Here

    LineReader in = null;
    try {
      in = new LineReader(fs.open(userloc));
      while (in.readLine(rawUgi) > 0) {//line is of the form username[,group]*
        // e is end position of user name in this line
        int e = rawUgi.find(",");
        if (rawUgi.getLength() == 0 || e == 0) {
          throw new IOException("Missing username: " + rawUgi);
        }
        if (e == -1) {
          e = rawUgi.getLength();
View Full Code Here

    public Tuple getNext() throws IOException {
        try {
            String subject = "";
            while (reader.nextKeyValue()) {
                final Text line = reader.getCurrentValue();
                if (line.find("Subject: ") == 0) {
                    subject = line.toString().replace("Subject: ", "");
                }
                if (line.getLength() == 0) {
                    break;
                }
View Full Code Here

    LineReader in = null;
    try {
      final ArrayList<String> groups = new ArrayList();
      in = new LineReader(fs.open(userloc));
      while (in.readLine(rawUgi) > 0) {
        int e = rawUgi.find(",");
        if (e <= 0) {
          throw new IOException("Missing username: " + rawUgi);
        }
        final String username = Text.decode(rawUgi.getBytes(), 0, e);
        int s = e;
View Full Code Here

        if (e <= 0) {
          throw new IOException("Missing username: " + rawUgi);
        }
        final String username = Text.decode(rawUgi.getBytes(), 0, e);
        int s = e;
        while ((e = rawUgi.find(",", ++s)) != -1) {
          groups.add(Text.decode(rawUgi.getBytes(), s, e - s));
          s = e;
        }
        groups.add(Text.decode(rawUgi.getBytes(), s, rawUgi.getLength() - s));
        if (groups.size() == 0) {
View Full Code Here

    return parseDocID(key);
  }
 
  public static Text parseDocID(Key key) {
    Text colq = key.getColumnQualifier();
    int firstZeroIndex = colq.find("\0");
    if (firstZeroIndex < 0) {
      throw new IllegalArgumentException("bad docid: " + key.toString());
    }
    int secondZeroIndex = colq.find("\0", firstZeroIndex + 1);
    if (secondZeroIndex < 0) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.