Package org.marc4j.marc

Examples of org.marc4j.marc.Record


        MarcReader reader = new MarcPermissiveStreamReader(in,true,true,"IS05426");
        System.err.println("Using IS05426 for conversion");
        MarcXmlWriter writer = new MarcXmlWriter(out, outputEncoding, true);

        while (reader.hasNext()) {
            Record record = reader.next();

            writer.write(record);
        }
        writer.close();
    }
View Full Code Here


      .getLogger(MarcImporterTest.class);

  public void testNewPropertyRecord() throws FileNotFoundException {
    MarcXmlReader marcXmlReader = new MarcXmlReader(new FileInputStream(
        new File("test/input/singleOne.xml")));
    Record marcRecord = marcXmlReader.next();
    logger.info(marcRecord);
    MarcImporter marcImporter = new MarcImporter();
    HashMap<String, String> mappings = new HashMap<String, String>();
    marcImporter.setMappings(mappings);
    mappings.put("001", "_id");
View Full Code Here

    if (propertyRecordDao == null) {
      throw new IllegalStateException("propertyRecordDao not set!");
    }
    MarcXmlReader marcXmlReader = new MarcXmlReader(in);
    while (marcXmlReader.hasNext()) {
      Record record = marcXmlReader.next();
      PropertyRecord propertyRecord = newPropertyRecord(record);

      propertyRecordDao.registerEntity(propertyRecord, null);
    }
  }
View Full Code Here

                MarcWriter writer = new MarcXmlWriter(os, true);
               
                MarcPermissiveStreamReader reader = new MarcPermissiveStreamReader(
                    inputStream, true, true);
                while (reader.hasNext()) {
                    Record record = reader.next();
                    writer.write(record);
                }
                writer.close();
            } finally {
                try {
View Full Code Here

      log.debug("flush");
      pos.flush();
      pos.close();
      log.debug("attempt to read marcxml from pipe");
      if (reader.hasNext()) {
        Record record = reader.next();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        MarcWriter writer = new MarcStreamWriter(baos);
        writer.write(record);
        result = baos.toByteArray();
        log.debug("Result of transform to marc: "+new String(result));
View Full Code Here

      MarcReader reader = new MarcStreamReader(new ByteArrayInputStream((byte[])native_object));
      javax.xml.transform.dom.DOMResult result = new javax.xml.transform.dom.DOMResult();
      MarcXmlWriter writer = new MarcXmlWriter(result);
      writer.setConverter(new org.marc4j.converter.impl.AnselToUnicode());
      if (reader.hasNext()) {
        Record record = (Record) reader.next();
        writer.write(record);
      }
      writer.close();

      retval = (Document) result.getNode();
View Full Code Here

        MarcStreamReader reader = new MarcStreamReader(input);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        MarcStreamWriter writer = new MarcStreamWriter(out);
        while (reader.hasNext()) {
            Record record = reader.next();
            writer.write(record);
            counter++;
        }
        input.close();
        writer.close();

        assertEquals(1, counter);

        counter = 0;

        input = new ByteArrayInputStream(out.toByteArray());

        reader = new MarcStreamReader(input);
        while (reader.hasNext()) {
            Record record = reader.next();
            counter++;
        }
        input.close();

        assertEquals(1, counter);
View Full Code Here

        MarcStreamReader reader = new MarcStreamReader(input);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        MarcStreamWriter writer = new MarcStreamWriter(out, "UTF8");
        writer.setConverter(new AnselToUnicode());
        while (reader.hasNext()) {
            Record record = reader.next();
            writer.write(record);
            counter++;
        }
        input.close();
        writer.close();

        assertEquals(8, counter);

        counter = 0;

        input = new ByteArrayInputStream(out.toByteArray());

        reader = new MarcStreamReader(input, "UTF8");

        while (reader.hasNext()) {
            Record record = reader.next();
            counter++;
        }
        input.close();

        assertEquals(8, counter);
View Full Code Here

        int i = 0;
        InputStream input = getClass().getResourceAsStream(
                "resources/chabon.mrc");
        MarcStreamReader reader = new MarcStreamReader(input);
        while (reader.hasNext()) {
            Record record = reader.next();
            System.err.println(record.toString());
            i++;
        }
        input.close();
        assertEquals(2, i);
    }
View Full Code Here

        int i = 0;
        InputStream input = getClass().getResourceAsStream(
                "resources/chabon.xml");
        MarcXmlReader reader = new MarcXmlReader(input);
        while (reader.hasNext()) {
            Record record = reader.next();
            System.err.println(record.toString());
            i++;
        }
        input.close();
        assertEquals(2, i);
    }
View Full Code Here

TOP

Related Classes of org.marc4j.marc.Record

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.