/** * Returns a ByteReader for the input stream supplied. * @param in an input stream * @return a Byte reader * @throws IOException if the input stream could not be read */ protected ByteReader newByteReader(InputStream in) throws IOException { IdentificationRequest<InputStream> request = getRequestFactory().newRequest(null, null); request.open(in); return new IdentificationRequestByteReaderAdapter(request); }
/** * Returns a ByteReader for the input stream supplied. * @param in an input stream * @return a Byte reader * @throws IOException if the input stream could not be read */ protected ByteReader newByteReader(InputStream in) throws IOException { IdentificationRequest<InputStream> request = getRequestFactory().newRequest(null, null); request.open(in); return new IdentificationRequestByteReaderAdapter(request); }
identifier.setParentResourceId(parentId); identifier.setResourceId(nodeId); IdentificationRequest<File> request = requestFactory.newRequest(metaData, identifier); try { request.open(file);
private void submitFile(FsFile file, FsDirectoryEntry entry) throws IOException { FsDirectoryEntry parent = parentMap.get(entry); ResourceId correlationId = rootParentId; if (parent != null) { correlationId = directories.get(parent); } RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toFatImageUri(fatFileUri, expand(entry, parentMap))); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); RequestMetaData requestMetaData = new RequestMetaData(file.getLength(), entry.getCreated(), entry.getName()); IdentificationRequest<InputStream> req = factory.newRequest(requestMetaData, identifier); Path tempFile = ArchiveFileUtils.writeFsFileToTemp(entry, ((FatFileIdentificationRequest) req).getTempDir()); InputStream is = new FileInputStream(tempFile.toFile()); req.open(is); droid.submit(req); }
/** * Submits a request to droid. * @param info the sevenzip entry and stream to submit * @param entryName the name of the entry * @param correlationId the correlation iod for the request * @throws IOException if the input stream could not be read */ final void submit(SevenZEntryInfo info, String entryName, ResourceId correlationId) throws IOException { long size = info.entry.getSize(); Date time = new Date(); RequestMetaData metaData = new RequestMetaData( size == -1 ? null : size, time == null ? null : time.getTime(), entryName); RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toSevenZUri(parentName, info.entry.getName())); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); if (identifier.getParentPrefix() != null && identifier.getParentPrefix().isEmpty()) { identifier.setParentPrefix(null); } IdentificationRequest<InputStream> request = factory.newRequest(metaData, identifier); request.open(info.stream); droid.submit(request); }
identifier.setParentId(correlationId); archiveRequest = factory.newRequest(metaData, identifier); final InputStream gzin = new GZIPInputStream(in); try {
identifier.setParentId(correlationId); archiveRequest = factory.newRequest(metaData, identifier); final InputStream gzin = new GZIPInputStream(in); try {
identifier.setParentId(correlationId); archiveRequest = factory.newRequest(metaData, identifier); final InputStream bzin = new BZip2CompressorInputStream(in); try {
private void submitFile(FileHeader entry) throws IOException, URISyntaxException, RarException { String fullpath = entry.getFileNameString(); String path = FilenameUtils.getPath(fullpath); String name = FilenameUtils.getName(fullpath); //CHECKSTYLE:OFF log.debug("submitFile, processing path: " + path + " name: " + name); //CHECKSTYLE:ON ResourceId correlationId = getFromDirCache(path); if (correlationId == null) { correlationId = submitDirectory(path, entry.getMTime()); } InputStream entryInputStream = archive.getInputStream(entry); RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toRarUri(parentURI, path + name)); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); RequestMetaData metaData = new RequestMetaData(entry.getUnpSize(), entry.getMTime().getTime(), name); IdentificationRequest<InputStream> request = identificationRequestFactory.newRequest(metaData, identifier); request.open(entryInputStream); droid.submit(request); }
identifier.setParentId(correlationId); archiveRequest = factory.newRequest(metaData, identifier); final InputStream bzin = new BZip2CompressorInputStream(in); try {
/** * Submits a request for a single file to droid. * @param webArchiveType arc or warc * @param metaData file size, time and name * @param parentName the name of the parent file * @param payload the file input stream * @param correlationId the correlation Id for the request * @param originatorNodeId the Id of the originator node * @throws IOException if the input stream could not be read */ final void submit(String webArchiveType, RequestMetaData metaData, URI parentName, InputStream payload, ResourceId correlationId, long originatorNodeId) throws IOException { RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toWebArchiveUri(webArchiveType, parentName, metaData.getName())); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); IdentificationRequest request = factory.newRequest(metaData, identifier); request.open(payload); // get the inputstream back from the record, and write it out to file droidCore.submit(request); }
private void submitFile(FileHeader entry) throws IOException, URISyntaxException, RarException { String fullpath = entry.getFileNameString(); String path = FilenameUtils.getPath(fullpath); String name = FilenameUtils.getName(fullpath); //CHECKSTYLE:OFF log.debug("submitFile, processing path: " + path + " name: " + name); //CHECKSTYLE:ON ResourceId correlationId = getFromDirCache(path); if (correlationId == null) { correlationId = submitDirectory(path, entry.getMTime()); } InputStream entryInputStream = archive.getInputStream(entry); RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toRarUri(parentURI, path + name)); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); RequestMetaData metaData = new RequestMetaData(entry.getUnpSize(), entry.getMTime().getTime(), name); IdentificationRequest<InputStream> request = identificationRequestFactory.newRequest(metaData, identifier); request.open(entryInputStream); droid.submit(request); }
/** * Submits a request for a single file to droid. * @param webArchiveType arc or warc * @param metaData file size, time and name * @param parentName the name of the parent file * @param payload the file input stream * @param correlationId the correlation Id for the request * @param originatorNodeId the Id of the originator node * @throws IOException if the input stream could not be read */ final void submit(String webArchiveType, RequestMetaData metaData, URI parentName, InputStream payload, ResourceId correlationId, long originatorNodeId) throws IOException { RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toWebArchiveUri(webArchiveType, parentName, metaData.getName())); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); IdentificationRequest request = factory.newRequest(metaData, identifier); request.open(payload); // get the inputstream back from the record, and write it out to file droidCore.submit(request); }
private void submitFile(Iso9660FileEntry entry) throws IOException, URISyntaxException { String path = FilenameUtils.getPath(entry.getPath()); String name = entry.getName(); ResourceId correlationId = this.directories.get(path); if (correlationId == null) { correlationId = submitDirectory(path, entry.getLastModifiedTime()); } InputStream entryInputStream = fileSystem.getInputStream(entry); try { RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toIsoImageUri(isoFileUri, path + name)); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); RequestMetaData metaData = new RequestMetaData(entry.getSize(), entry.getLastModifiedTime(), name); IdentificationRequest<InputStream> request = factory.newRequest(metaData, identifier); request.open(entryInputStream); droid.submit(request); } finally { try { if (entryInputStream != null) { entryInputStream.close(); } } catch (IOException ex) { log.warn("failed to close entryInputStream", ex); } } }
private void submitFile(Iso9660FileEntry entry) throws IOException, URISyntaxException { String path = FilenameUtils.getPath(entry.getPath()); String name = entry.getName(); ResourceId correlationId = this.directories.get(path); if (correlationId == null) { correlationId = submitDirectory(path, entry.getLastModifiedTime()); } InputStream entryInputStream = fileSystem.getInputStream(entry); try { RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toIsoImageUri(isoFileUri, path + name)); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); RequestMetaData metaData = new RequestMetaData(entry.getSize(), entry.getLastModifiedTime(), name); IdentificationRequest<InputStream> request = factory.newRequest(metaData, identifier); request.open(entryInputStream); droid.submit(request); } finally { try { if (entryInputStream != null) { entryInputStream.close(); } } catch (IOException ex) { log.warn("failed to close entryInputStream", ex); } } }
/** * Submits a request to droid. * @param entry the tar entry to submit * @param entryName the name of the entry * @param parentName the name of the parent file * @param in the archive input stream * @param correlationId the correlation iod for the request * @param originatorNodeId the ID of the originator node * @throws IOException if the input stream could not be read */ final void submit(TarArchiveEntry entry, String entryName, URI parentName, ArchiveInputStream in, ResourceId correlationId, long originatorNodeId) throws IOException { long size = entry.getSize(); Date time = entry.getModTime(); RequestMetaData metaData = new RequestMetaData( size == -1 ? null : size, time == null ? null : time.getTime(), entryName); RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toTarUri(parentName, entry.getName())); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); IdentificationRequest<InputStream> request = factory.newRequest(metaData, identifier); request.open(in); droidCore.submit(request); }
/** * Submits a request to droid. * @param entry the tar entry to submit * @param entryName the name of the entry * @param parentName the name of the parent file * @param in the archive input stream * @param correlationId the correlation iod for the request * @param originatorNodeId the ID of the originator node * @throws IOException if the input stream could not be read */ final void submit(TarArchiveEntry entry, String entryName, URI parentName, ArchiveInputStream in, ResourceId correlationId, long originatorNodeId) throws IOException { long size = entry.getSize(); Date time = entry.getModTime(); RequestMetaData metaData = new RequestMetaData( size == -1 ? null : size, time == null ? null : time.getTime(), entryName); RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toTarUri(parentName, entry.getName())); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); IdentificationRequest<InputStream> request = factory.newRequest(metaData, identifier); request.open(in); droidCore.submit(request); }
/** * Submits a request to droid. * @param entry the tar entry to submit * @param entryName the name of the entry * @param correlationId the correlation iod for the request * @throws IOException if the input stream could not be read */ final void submit(SevenZArchiveEntry entry, String entryName, ResourceId correlationId) throws IOException { long size = entry.getSize(); Date time = new Date(); RequestMetaData metaData = new RequestMetaData( size == -1 ? null : size, time == null ? null : time.getTime(), entryName); RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toSevenZUri(parentName, entry.getName())); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId); if (identifier.getParentPrefix() != null && identifier.getParentPrefix().isEmpty()) { identifier.setParentPrefix(null); } IdentificationRequest<InputStream> request = factory.newRequest(metaData, identifier); BoundedInputStream entryInputStream = new BoundedInputStream(in, entry.getSize()); entryInputStream.setPropagateClose(false); request.open(entryInputStream); if (!entry.isDirectory()) { droid.submit(request); } }
identifier.setParentResourceId(correlationId); IdentificationRequest request = factory.newRequest(metaData, identifier); InputStream in = null; try {
identifier.setParentResourceId(correlationId); IdentificationRequest request = factory.newRequest(metaData, identifier); InputStream in = null; try {