protected ArchiveRecord innerNext() throws IOException { return get(positionForRecord(getIn())); }
@Override public WARCRecord get(long offset) throws IOException { return (WARCRecord)super.get(offset); } @Override
/** * Output passed record using passed format specifier. * @param format What format to use outputting. * @throws IOException * @return True if handled. */ public boolean outputRecord(final String format) throws IOException { boolean result = true; if (format.equals(CDX)) { System.out.println(get().outputCdx(getStrippedFileName())); } else if(format.equals(ArchiveFileConstants.DUMP)) { // No point digesting if dumping content. setDigest(false); get().dump(); } else { result = false; } return result; }
protected Resource loadResource(String path, InputStream is) throws IOException, ResourceNotAvailableException { ArchiveReader archiveReader = ArchiveReaderFactory.get(path, is, false); if (archiveReader instanceof ARCReader) { return new ArcResource((ARCRecord)archiveReader.get(), archiveReader); } else if (archiveReader instanceof WARCReader) { return new WarcResource((WARCRecord)archiveReader.get(), archiveReader); } else { throw new IOException("Unknown ArchiveReader"); } }
protected ArchiveRecord innerNext() throws IOException { return get(positionForRecord(getIn())); }
/** * Output passed record using passed format specifier. * @param format What format to use outputting. * @throws IOException * @return True if handled. */ public boolean outputRecord(final String format) throws IOException { boolean result = true; if (format.equals(CDX)) { System.out.println(get().outputCdx(getStrippedFileName())); } else if(format.equals(ArchiveFileConstants.DUMP)) { // No point digesting if dumping content. setDigest(false); get().dump(); } else { result = false; } return result; }
protected Resource loadResource(String path, InputStream is) throws IOException, ResourceNotAvailableException { ArchiveReader archiveReader = ArchiveReaderFactory.get(path, is, false); if (archiveReader instanceof ARCReader) { return new ArcResource((ARCRecord)archiveReader.get(), archiveReader); } else if (archiveReader instanceof WARCReader) { return new WarcResource((WARCRecord)archiveReader.get(), archiveReader); } else { throw new IOException("Unknown ArchiveReader"); } }
protected ArchiveRecord innerNext() throws IOException { return get(positionForRecord(getIn())); }
/** * Output passed record using passed format specifier. * @param format What format to use outputting. * @throws IOException * @return True if handled. */ public boolean outputRecord(final String format) throws IOException { boolean result = true; if (format.equals(CDX)) { System.out.println(get().outputCdx(getStrippedFileName())); } else if(format.equals(ArchiveFileConstants.DUMP)) { // No point digesting if dumping content. setDigest(false); get().dump(); } else { result = false; } return result; }
public static Resource getResource(File file, long offset) throws IOException, ResourceNotAvailableException { Resource r = null; String name = file.getName(); if (name.endsWith(ArcWarcFilenameFilter.OPEN_SUFFIX)) { name = name.substring(0, name.length() - ArcWarcFilenameFilter.OPEN_SUFFIX.length()); } RandomAccessFile raf = new RandomAccessFile(file, "r"); raf.seek(offset); InputStream is = new FileInputStream(raf.getFD()); String fPath = file.getAbsolutePath(); if (isArc(name)) { ArchiveReader reader = ARCReaderFactory.get(name, is, false); r = ARCArchiveRecordToResource(reader.get(), reader); } else if (isWarc(name)) { ArchiveReader reader = WARCReaderFactory.get(name, is, false); r = WARCArchiveRecordToResource(reader.get(), reader); } else { is.close(); raf.close(); throw new ResourceNotAvailableException("Unknown extension"); } return r; } public static Resource getResource(URL url, long offset)
public static Resource getResource(File file, long offset) throws IOException, ResourceNotAvailableException { Resource r = null; String name = file.getName(); if (name.endsWith(ArcWarcFilenameFilter.OPEN_SUFFIX)) { name = name.substring(0, name.length() - ArcWarcFilenameFilter.OPEN_SUFFIX.length()); } RandomAccessFile raf = new RandomAccessFile(file, "r"); raf.seek(offset); InputStream is = new FileInputStream(raf.getFD()); String fPath = file.getAbsolutePath(); if (isArc(name)) { ArchiveReader reader = ARCReaderFactory.get(name, is, false); r = ARCArchiveRecordToResource(reader.get(), reader); } else if (isWarc(name)) { ArchiveReader reader = WARCReaderFactory.get(name, is, false); r = WARCArchiveRecordToResource(reader.get(), reader); } else { is.close(); raf.close(); throw new ResourceNotAvailableException("Unknown extension"); } return r; } public static Resource getResource(URL url, long offset)