/** * Writes the logs stored in the entry as text files in folder, one per container. * * @param folder * @throws IOException */ public void write(final File folder) throws IOException { try (final DataInputStream keyStream = entry.getKeyStream(); final DataInputStream valueStream = entry.getValueStream();) { final String containerId = keyStream.readUTF(); try (final Writer outputWriter = new OutputStreamWriter( new FileOutputStream(new File(folder, containerId + ".txt")), StandardCharsets.UTF_8)) { this.writeFiles(valueStream, outputWriter); } } }
/** * Writes the contents of the entry into the given outputWriter. * * @param outputWriter * @throws IOException */ public void write(final Writer outputWriter) throws IOException { try (final DataInputStream keyStream = entry.getKeyStream(); final DataInputStream valueStream = entry.getValueStream();) { outputWriter.write("Container: "); outputWriter.write(keyStream.readUTF()); outputWriter.write("\n"); this.writeFiles(valueStream, outputWriter); } }
/** * Writes the contents of the entry into the given outputWriter * * @param outputWriter * @throws IOException */ public void write(final Writer outputWriter) throws IOException { try (final DataInputStream keyStream = entry.getKeyStream(); final DataInputStream valueStream = entry.getValueStream();) { outputWriter.write("Container: "); outputWriter.write(keyStream.readUTF()); outputWriter.write("\n"); this.writeFiles(valueStream, outputWriter); } }
while (!aclScanner.atEnd()) { TFile.Reader.Scanner.Entry entry = aclScanner.entry(); key.readFields(entry.getKeyStream()); if (key.toString().equals(APPLICATION_ACL_KEY.toString())) { DataInputStream valueStream = entry.getValueStream();
while (!aclScanner.atEnd()) { TFile.Reader.Scanner.Entry entry = aclScanner.entry(); key.readFields(entry.getKeyStream()); if (key.toString().equals(APPLICATION_ACL_KEY.toString())) { DataInputStream valueStream = entry.getValueStream();
while (!aclScanner.atEnd()) { TFile.Reader.Scanner.Entry entry = aclScanner.entry(); key.readFields(entry.getKeyStream()); if (key.toString().equals(APPLICATION_ACL_KEY.toString())) { DataInputStream valueStream = entry.getValueStream();
/** * Read the next key and return the value-stream. * * @param key * @return the valueStream if there are more keys or null otherwise. * @throws IOException */ public DataInputStream next(LogKey key) throws IOException { if (!this.atBeginning) { this.scanner.advance(); } else { this.atBeginning = false; } if (this.scanner.atEnd()) { return null; } TFile.Reader.Scanner.Entry entry = this.scanner.entry(); key.readFields(entry.getKeyStream()); // Skip META keys if (RESERVED_KEYS.containsKey(key.toString())) { return next(key); } DataInputStream valueStream = entry.getValueStream(); return valueStream; }
/** * Read the next key and return the value-stream. * * @param key * @return the valueStream if there are more keys or null otherwise. * @throws IOException */ public DataInputStream next(LogKey key) throws IOException { if (!this.atBeginning) { this.scanner.advance(); } else { this.atBeginning = false; } if (this.scanner.atEnd()) { return null; } TFile.Reader.Scanner.Entry entry = this.scanner.entry(); key.readFields(entry.getKeyStream()); // Skip META keys if (RESERVED_KEYS.containsKey(key.toString())) { return next(key); } DataInputStream valueStream = entry.getValueStream(); return valueStream; }
/** * Read the next key and return the value-stream. * * @param key * @return the valueStream if there are more keys or null otherwise. * @throws IOException */ public DataInputStream next(LogKey key) throws IOException { if (!this.atBeginning) { this.scanner.advance(); } else { this.atBeginning = false; } if (this.scanner.atEnd()) { return null; } TFile.Reader.Scanner.Entry entry = this.scanner.entry(); key.readFields(entry.getKeyStream()); // Skip META keys if (RESERVED_KEYS.containsKey(key.toString())) { return next(key); } DataInputStream valueStream = entry.getValueStream(); return valueStream; }
/** * Read the next key and return the value-stream. * * @param key the log key * @return the valueStream if there are more keys or null otherwise * @throws IOException if we can not get the dataInputStream * for the next key */ public DataInputStream next(LogKey key) throws IOException { if (!this.atBeginning) { this.scanner.advance(); } else { this.atBeginning = false; } if (this.scanner.atEnd()) { return null; } TFile.Reader.Scanner.Entry entry = this.scanner.entry(); key.readFields(entry.getKeyStream()); // Skip META keys if (RESERVED_KEYS.containsKey(key.toString())) { return next(key); } DataInputStream valueStream = entry.getValueStream(); return valueStream; }
/** * Returns the owner of the application. * * @return the application owner. * @throws IOException if we can not get the application owner. */ public String getApplicationOwner() throws IOException { TFile.Reader.Scanner ownerScanner = null; try { ownerScanner = reader.createScanner(); LogKey key = new LogKey(); while (!ownerScanner.atEnd()) { TFile.Reader.Scanner.Entry entry = ownerScanner.entry(); key.readFields(entry.getKeyStream()); if (key.toString().equals(APPLICATION_OWNER_KEY.toString())) { DataInputStream valueStream = entry.getValueStream(); return valueStream.readUTF(); } ownerScanner.advance(); } return null; } finally { IOUtils.cleanupWithLogger(LOG, ownerScanner); } }
/** * Returns the owner of the application. * * @return the application owner. * @throws IOException */ public String getApplicationOwner() throws IOException { TFile.Reader.Scanner ownerScanner = reader.createScanner(); LogKey key = new LogKey(); while (!ownerScanner.atEnd()) { TFile.Reader.Scanner.Entry entry = ownerScanner.entry(); key.readFields(entry.getKeyStream()); if (key.toString().equals(APPLICATION_OWNER_KEY.toString())) { DataInputStream valueStream = entry.getValueStream(); return valueStream.readUTF(); } ownerScanner.advance(); } return null; }
/** * Returns the owner of the application. * * @return the application owner. * @throws IOException */ public String getApplicationOwner() throws IOException { TFile.Reader.Scanner ownerScanner = reader.createScanner(); LogKey key = new LogKey(); while (!ownerScanner.atEnd()) { TFile.Reader.Scanner.Entry entry = ownerScanner.entry(); key.readFields(entry.getKeyStream()); if (key.toString().equals(APPLICATION_OWNER_KEY.toString())) { DataInputStream valueStream = entry.getValueStream(); return valueStream.readUTF(); } ownerScanner.advance(); } return null; }
/** * Writes the logs stored in the entry as text files in folder, one per container. * * @param folder * @throws IOException */ public void write(final File folder) throws IOException { try (final DataInputStream keyStream = entry.getKeyStream(); final DataInputStream valueStream = entry.getValueStream();) { final String containerId = keyStream.readUTF(); try (final Writer outputWriter = new FileWriter(new File(folder, containerId + ".txt"))) { this.writeFiles(valueStream, outputWriter); } } }
public Entry next() throws IOException { TFile.Reader.Scanner.Entry entry = scanner.entry(); DataInputStream dis = entry.getKeyStream(); HistoryDataKey key = new HistoryDataKey(); key.readFields(dis); dis = entry.getValueStream(); byte[] value = new byte[entry.getValueLength()]; dis.read(value); scanner.advance(); return new Entry(key, value); }
public Entry next() throws IOException { TFile.Reader.Scanner.Entry entry = scanner.entry(); DataInputStream dis = entry.getKeyStream(); HistoryDataKey key = new HistoryDataKey(); key.readFields(dis); dis = entry.getValueStream(); byte[] value = new byte[entry.getValueLength()]; dis.read(value); scanner.advance(); return new Entry(key, value); }
public Entry next() throws IOException { TFile.Reader.Scanner.Entry entry = scanner.entry(); DataInputStream dis = entry.getKeyStream(); HistoryDataKey key = new HistoryDataKey(); key.readFields(dis); dis = entry.getValueStream(); byte[] value = new byte[entry.getValueLength()]; dis.read(value); scanner.advance(); return new Entry(key, value); }