Package org.apache.abdera.i18n.text.io

Examples of org.apache.abdera.i18n.text.io.PeekAheadInputStream.peek()


    public void testPeekAheadInputStream() throws Exception {
        ByteArrayInputStream in = new ByteArrayInputStream(new byte[] {0x01, 0x02, 0x03, 0x04});
        PeekAheadInputStream pais = new PeekAheadInputStream(in);
        byte[] peek = new byte[2];
        byte[] read = new byte[2];
        pais.peek(peek);
        pais.read(read);
        assertEquals(read[0], peek[0]);
        assertEquals(read[1], peek[1]);
        byte[] newread = new byte[2];
        assertFalse(read[0] == newread[0]);
View Full Code Here


    private String detectVersion() throws IOException {
        String version = "1.0";
        PeekAheadInputStream pin = (PeekAheadInputStream)this.in;
        try {
            byte[] p = new byte[200];
            pin.peek(p);
            XMLStreamReader xmlreader =
                XMLInputFactory.newInstance().createXMLStreamReader(new java.io.ByteArrayInputStream(p));
            String v = xmlreader.getVersion();
            if (v != null)
                version = v;
View Full Code Here

    protected String detectEncoding() throws IOException {
        String charset = super.detectEncoding();
        PeekAheadInputStream pin = getInternal();
        try {
            byte[] p = new byte[200];
            pin.peek(p);
            XMLStreamReader xmlreader =
                XMLInputFactory.newInstance().createXMLStreamReader(new java.io.ByteArrayInputStream(p));
            String cs = xmlreader.getCharacterEncodingScheme();
            if (cs != null)
                charset = cs;
View Full Code Here

  private String detectVersion() throws IOException {
    String version = "1.0";
    PeekAheadInputStream pin = (PeekAheadInputStream) this.in;
    try {
      byte[] p = new byte[200];
      pin.peek(p);
      XMLStreamReader xmlreader =
        XMLInputFactory.newInstance().createXMLStreamReader(
          new java.io.ByteArrayInputStream(p));
      String v = xmlreader.getVersion();
      if (v != null) version = v;
View Full Code Here

  protected String detectEncoding() throws IOException {
    String charset = super.detectEncoding();
    PeekAheadInputStream pin = getInternal();
    try {
      byte[] p = new byte[200];
      pin.peek(p);
      XMLStreamReader xmlreader =
        XMLInputFactory.newInstance().createXMLStreamReader(
          new java.io.ByteArrayInputStream(p));
      String cs = xmlreader.getCharacterEncodingScheme();
      if (cs != null) charset = cs;
View Full Code Here

  public void testPeekAheadInputStream() throws Exception {
    ByteArrayInputStream in = new ByteArrayInputStream(new byte[] {0x01,0x02,0x03,0x04});
    PeekAheadInputStream pais = new PeekAheadInputStream(in);
    byte[] peek = new byte[2];
    byte[] read = new byte[2];
    pais.peek(peek);
    pais.read(read);
    assertEquals(peek[0],read[0]);
    assertEquals(peek[1],read[1]);
    byte[] newread = new byte[2];
    assertFalse(read[0] == newread[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.