Text from item.
@param item Item
@return Text contents of item
@throws IOException If some problem inside
11590
@SuppressWarnings("PMD.AssignmentInOperand")
    private String text(final T item) throws IOException {
        final String text;
        try (
            InputStream input = this.itemBody(item);
            ByteArrayOutputStream output = new ByteArrayOutputStream()
        ) {
            // @checkstyle MagicNumberCheck (1 line)
            final byte[] buffer = new byte[1024];
            int len;
            while ((len = input.read(buffer, 0, buffer.length)) != -1) {
                output.write(buffer, 0, len);
            }
            output.flush();
            text = new String(output.toByteArray(), this.charset);
        }
        return text;
    }
384288
public static String getStreamContents(InputStream is) throws IOException {
        Preconditions.checkNotNull(is, "Cannot get String from a null object");
        final char[] buffer = new char[0x10000];
        final StringBuilder out = new StringBuilder();
        try (Reader in = new InputStreamReader(is, "UTF-8")) {
            int read;
            do {
                read = in.read(buffer, 0, buffer.length);
                if (read > 0) {
                    out.append(buffer, 0, read);
                }
            } while (read >= 0);
        }
        return out.toString();
    }
650538
private String toText(AstNode node) throws IOException {
    StringBuilder out = new StringBuilder();
    if (node instanceof StringContentNode) {
      out.append(((StringContentNode)node).getContent());
    } else if (node instanceof ContentNode) {
      NodeList nodes = ((ContentNode) node).getContent();
      for (AstNode subNode : nodes) {
        out.append(toText(subNode));
      }
    }
    return out.toString();
  }
364870
public void writeContent(final OutputStream result) throws IOException
    {
        if(!this.inTable) {
            result.write(OPEN_GROUP);
        }
        
        int itemNr = 0;
        if(items != null) {
        for(int i = 0; i < items.size(); i++) {
        	
            RtfElement thisRtfElement = (RtfElement) items.get(i);
           //thisRtfElement.writeContent(result);
            if(thisRtfElement instanceof RtfListItem) {
                itemNr++;
            	RtfListItem rtfElement = (RtfListItem)thisRtfElement;
            	RtfListLevel listLevel =  rtfElement.getParent();
                if(listLevel.getListLevel() == 0) {
                    correctIndentation();
                }
                
                if(i == 0) {
                	listLevel.writeListBeginning(result);
                    writeListNumbers(result);
                }

                writeListTextBlock(result, itemNr, listLevel);
                
                rtfElement.writeContent(result);
                
                if(i < (items.size() - 1) || !this.inTable || listLevel.getListType() > 0) { // TODO Fix no paragraph on last list item in tables
                    result.write(RtfParagraph.PARAGRAPH);
                }
                this.document.outputDebugLinebreak(result);
            } else if(thisRtfElement instanceof RtfList) {
            	((RtfList)thisRtfElement).writeContent(result);
//            	((RtfList)thisRtfElement).writeListBeginning(result);
                writeListNumbers(result);
                this.document.outputDebugLinebreak(result);
            }
        }
        }
        if(!this.inTable) {
            result.write(CLOSE_GROUP);
        }
        result.write(RtfParagraph.PARAGRAPH_DEFAULTS);
    }
163197
public void addItem(T item) {
        mListItems.add(item);
        notifyItemInserted(mListItems.indexOf(item));
    }
868651
public static String quoteHtmlChars(String item) {
    if (item == null) {
      return null;
    }
    byte[] bytes = item.getBytes();
    if (needsQuoting(bytes, 0, bytes.length)) {
      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
      try {
        quoteHtmlChars(buffer, bytes, 0, bytes.length);
      } catch (IOException ioe) {
        // Won't happen, since it is a bytearrayoutputstream
      }
      return buffer.toString();
    } else {
      return item;
    }
  }
90791
public static String getReaderContentAsString(Reader reader) throws IOException {

        int count;
        final char[] buffer = new char[2048];
        final StringBuilder out = new StringBuilder();
        while ((count = reader.read(buffer, 0, buffer.length)) >= 0) {
            out.append(buffer, 0, count);
        }

        return (out.toString());
    }
979938
private static <T> String name(T item, String name) {
    if (name != null && !name.isEmpty()) {
      return name;
    } else if (item instanceof HasMetadata) {
      HasMetadata h = (HasMetadata) item;
      return h.getMetadata() != null ? h.getMetadata().getName() : null;
    }
    return null;
  }
278029
private InputStream getStream(List<FileItem> items) throws IOException {
        for (FileItem i : items) {
            if (!i.isFormField() && i.getFieldName().equals(CONTENT_PARAMETER)) {
                return i.getInputStream();
            }
        }
        return null;
    }
1267980
public void set(ResultItem item){
        try {
            if (item.getValueType() == ValueType.DOCUMENT) {
                content = item.asString().getBytes("UTF-8");
                contentType = ContentType.XML;
            } else if (item.getValueType() == ValueType.ELEMENT) {
                content = item.asString().getBytes("UTF-8");
                contentType = ContentType.XML;
            } else if (item.getValueType() == ValueType.TEXT) {
                content = item.asString().getBytes("UTF-8");
                contentType = ContentType.TEXT;
            } else if (item.getValueType() == ValueType.BINARY) {
                if (item.isCached()) {
                    content = ((XdmBinary) item.getItem()).asBinaryData();
                } else {
                    is = item.asInputStream();
                }
                contentType = ContentType.BINARY;
            } else if (item.getValueType() == ValueType.ARRAY_NODE ||
                item.getValueType() == ValueType.BOOLEAN_NODE ||
                item.getValueType() == ValueType.NULL_NODE ||
                item.getValueType() == ValueType.NUMBER_NODE ||
                item.getValueType() == ValueType.OBJECT_NODE) {
                content = item.asString().getBytes("UTF-8");
                contentType = ContentType.JSON;
            } else {
                contentType = ContentType.UNKNOWN;
            }
        } catch (UnsupportedEncodingException e) {
            LOG.error(e);
        }
    }
757
public static String readContent( Reader in ) throws IOException
    {
        char[] buffer = new char[2048];
        StringBuilder sb = new StringBuilder();
        int read;
        while ((read = in.read( buffer )) != -1)
        {
            sb.append( buffer, 0, read );
        }

        return sb.toString();
    }
529212
public String loadTextFile(File source) throws IOException
	{
		StringBuffer _result = new StringBuffer();
		append(source, _result);
		return _result.toString();
	}
1097097
public static ValueListItem retrieve(String item) throws StripeException {
    return retrieve(item, (Map<String, Object>) null, (RequestOptions) null);
  }
715220
public int getIndex(Object item) {
	  if (!itemIndex.containsKey(item)) {
	    throw new NoSuchElementException("No such item: " + item);
	  }
		return itemIndex.get(item);
	}
305265
public T match(I item)
    {
        Set<T> set = mapSet.get(item);
        if (set.size() == 1)
        {
            T match = set.iterator().next();
            unmap(match);
            return match;
        }
        return null;
    }
1204608
@Override
	public void processItemDocument(ItemDocument itemDocument) {
		this.countItems++;

		// Do some printing for demonstration/debugging.
		// Only print at most 50 items (or it would get too slow).
		if (this.countItems < 10) {
			System.out.println(itemDocument);
		} else if (this.countItems == 10) {
			System.out.println("*** I won't print any further items.\n"
					+ "*** We will never finish if we print all the items.\n"
					+ "*** Maybe remove this debug output altogether.");
		}
	}
762562
public static String getText(int type) {
        String text = "";

        if (TEXTS.containsKey(type)) {
            text = TEXTS.get(type);
        }

        return text;
    }