|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectes.mcu.yingo.utils.fichero.UtilFicheroImp
public class UtilFicheroImp
Implementación estandar del interfaz UtilFichero
y que constituye un gestor de ficheros que permite crear, borrar y
manipular ficheros
Clase de utilidades de Fichero. Está siempre asociada a un directorio base
que se utilizará para recuperar de este directorio archivos o crear en dicho
directorio ficheros.
| Field Summary | |
|---|---|
static java.lang.String |
CONSTANTE_MD5
Clave para definir el resumen criptográfico MD5 |
static java.lang.String |
CONSTANTE_SHA1
Clave para definir el resumen criptográfico SHA1 |
(package private) org.apache.commons.logging.Log |
logger
|
private java.lang.String |
pathBase
Directorio base |
(package private) java.lang.String |
pathIntermedio
Path intermedio que se concatenara al path base |
| Constructor Summary | |
|---|---|
UtilFicheroImp()
|
|
| Method Summary | |
|---|---|
(package private) boolean |
anadirPath(java.lang.StringBuilder res,
java.lang.String cadena,
boolean bBase)
Añade la cadena al StringBuilder, añadiendo o no el caracter de File.separator |
private boolean |
anadirPathIntermedio(java.lang.StringBuilder res)
Añade el path intermedio configurado en el atributo de la clase al path total |
void |
borrarFichero(java.lang.String pathRelativoFichero)
Borra un fichero o directorio con el path Relativo |
void |
borrarFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Borra un fichero o directorio con el path Relativo y el nombre del fichero |
void |
borrarFicheroYDirectorioSiVacio(java.lang.String pathRelativoFichero)
Borra el directorio y el fichero si al borrar el fichero este se encuentra vacío |
private void |
crearPath(java.lang.String rutaRelativa)
Crea la ruta relativa de directorios |
java.lang.String |
crearZip(java.lang.String[] nombreFicheros,
java.lang.String[] destinoFicheros)
Crea un fichero en formato zip y devuelve la ruta de éste |
protected void |
escribir(java.io.InputStream miInputStream,
java.io.OutputStream miOutputStream)
Lee el inputStream y lo escribe en el outputstream |
java.lang.String |
escribirFichero(java.io.InputStream miInputStream,
java.lang.String pathRelativoFichero)
Escribe un fichero a partir del InputStream |
java.lang.String |
escribirFichero(java.io.InputStream miInputStream,
java.lang.String pathRelativo,
java.lang.String nombreFichero)
Escribe un fichero en el path inicial, con el nombre que se le pasa |
java.lang.String |
escribirFicheroDeString(java.lang.String cadenaFichero,
java.lang.String pathRelativoFichero)
Escribe un fichero con el contenido del String cadena Fichero en la dirección relativa del fichero |
java.lang.String |
escribirFicheroDeString(java.lang.String cadenaFichero,
java.lang.String pathRelativo,
java.lang.String nombreFichero)
Escribe un fichero con el contenido de una cadena, el el directorio y con el nombre del fichero indicado |
void |
escribirFicheroToOutputStream(java.lang.String pathRelativoFichero,
java.io.OutputStream miOutputStream)
Escribe el fichero definido por el path relativo en el OutputStream |
void |
escribirFicheroToOutputStream(java.lang.String pathRelativo,
java.lang.String nombreFichero,
java.io.OutputStream miOutputStream)
Escribe el fichero definido por el path relativo y el nombre de fichero en el OutputStream |
boolean |
esDirectorioVacio(java.lang.String pathRelativoFichero)
Devuelve true si es un directorio y está vacio, en el resto de casos (fichero, directorio no vacío, etc..) |
boolean |
esDirectorioVacio(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Devuelve true si es un directorio y está vacio, en el resto de casos (fichero, directorio no vacío, etc..) |
boolean |
esFichero(java.lang.String pathRelativoFichero)
Devuelve si existe el fichero |
boolean |
esFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Devuelve si existe el fichero |
java.lang.String |
getPathBase()
Devuelve la ruta base del manejador de ficheros |
java.lang.String |
getPathIntermedio()
Ruta intermedia que se utulizará entre el path base y el nombre del fichero |
java.lang.String |
getPathRelativoFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Obtiene el path relatico del fichero |
java.lang.String |
getPathTotal(java.lang.String pathRelativoFichero)
Devuelve el la ruta absoluta con del path relativo del fichero |
java.lang.String |
getPathTotal(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Consigue el path total del fichero |
(package private) java.io.File |
obtenerFile(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Obtiene el objeto File del pathRelativo y del nombreFichero |
java.io.InputStream |
obtenerInputStreamFichero(java.lang.String pathRelativoFichero)
Devuelve el InputStream de un fichero |
java.io.InputStream |
obtenerInputStreamFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Devuelve el InputStream de un fichero |
java.lang.String |
obtenerMD5Fichero(java.lang.String pathRelativoFichero)
Obtiene el checkSum MD5 del fichero del fichero |
java.lang.String |
obtenerMD5Fichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Obtiene el checkSum MD5 del fichero definido por el path relativo y el nombre del fichero |
java.lang.String |
obtenerMimeFichero(java.lang.String pathRelativoFichero)
Obtiene el tipo Mime del fichero |
java.lang.String |
obtenerMimeFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Obtiene el tipo Mime del fichero con el path relativo y el nombre de fichero |
private java.lang.String |
obtenerResumenCriptografico(java.lang.String pathRelativo,
java.lang.String nombreFichero,
java.lang.String digest)
Obtiene el checkSum SHA1 ó MD5 del fichero definido por el path relativo y el nombre del fichero |
private java.lang.String |
obtenerResumenCriptograficoBase64(java.lang.String pathRelativo,
java.lang.String nombreFichero,
java.lang.String digest)
Obtiene el checkSum SHA1 ó MD5 del fichero definido por el path relativo y el nombre del fichero |
java.lang.String |
obtenerSHA1Fichero(java.lang.String pathRelativoFichero)
Obtiene el checkSum SHA1 del fichero del fichero |
java.lang.String |
obtenerSHA1Fichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Obtiene el checkSum SHA1 del fichero definido por el path relativo y el nombre del fichero |
java.lang.String |
obtenerSHA1FicheroBase64(java.lang.String pathRelativoFichero)
Obtiene el checkSum SHA1 del fichero en base64 |
java.lang.String |
obtenerSHA1FicheroBase64(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Obtiene el checkSum SHA1 del fichero definido por el path relativo y el nombre del fichero |
java.lang.String |
obtenerStringDeFichero(java.lang.String pathRelativoFichero)
Devuelve un String con el contenido del fichero |
java.lang.String |
obtenerStringDeFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Devuelve un String con el contenido del fichero, en el directorio relativo y con el nombre inidicado |
java.lang.Long |
obtenerTamanoFichero(java.lang.String pathRelativoFichero)
Obtiene el tamaño del fichero |
java.lang.Long |
obtenerTamanoFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
Obtiene el tamaño del fichero |
private void |
pasarSeguridad(java.lang.String path)
Implemetación de eguridad en los ficheros |
void |
setPathBase(java.lang.String pathBase)
Asigna la ruta base del manejador de ficheros |
void |
setPathIntermedio(java.lang.String pathIntermedio)
Ruta intermedia que se utulizará entre el path base y el nombre del fichero |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
final org.apache.commons.logging.Log logger
public static final java.lang.String CONSTANTE_SHA1
public static final java.lang.String CONSTANTE_MD5
private java.lang.String pathBase
java.lang.String pathIntermedio
| Constructor Detail |
|---|
public UtilFicheroImp()
| Method Detail |
|---|
public java.lang.String getPathBase()
getPathBase in interface UtilFicheropublic void setPathBase(java.lang.String pathBase)
setPathBase in interface UtilFicheropathBase -
private void pasarSeguridad(java.lang.String path)
throws FicheroYingoException
path -
FicheroYingoException
java.io.UnsupportedEncodingException
private void crearPath(java.lang.String rutaRelativa)
throws FicheroYingoException
rutaRelativa -
FicheroYingoException
public void borrarFichero(java.lang.String pathRelativoFichero)
throws FicheroYingoException
borrarFichero in interface UtilFicheropathRelativoFichero -
FicheroYingoException
public void borrarFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws FicheroYingoException
borrarFichero in interface UtilFicheropathRelativo - nombreFichero -
FicheroYingoException
public void borrarFicheroYDirectorioSiVacio(java.lang.String pathRelativoFichero)
throws FicheroYingoException
borrarFicheroYDirectorioSiVacio in interface UtilFicheropathRelativoFichero -
FicheroYingoExceptionprivate boolean anadirPathIntermedio(java.lang.StringBuilder res)
res -
FicheroYingoException
public java.lang.String getPathRelativoFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
getPathRelativoFichero in interface UtilFicheropathRelativo - nombreFichero -
boolean anadirPath(java.lang.StringBuilder res,
java.lang.String cadena,
boolean bBase)
res - cadena - bBase -
public java.lang.String getPathTotal(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws FicheroYingoException
getPathTotal in interface UtilFicheropathRelativo - nombreFichero -
FicheroYingoException
public java.lang.String getPathTotal(java.lang.String pathRelativoFichero)
throws FicheroYingoException
getPathTotal in interface UtilFicheropathRelativoFichero -
FicheroYingoException
public java.lang.String escribirFicheroDeString(java.lang.String cadenaFichero,
java.lang.String pathRelativoFichero)
throws java.io.IOException,
FicheroYingoException
escribirFicheroDeString in interface UtilFicherocadenaFichero - pathRelativoFichero -
java.io.IOException
FicheroYingoException
public void escribirFicheroToOutputStream(java.lang.String pathRelativo,
java.lang.String nombreFichero,
java.io.OutputStream miOutputStream)
throws java.io.IOException,
FicheroYingoException
escribirFicheroToOutputStream in interface UtilFicheropathRelativo - nombreFichero - miOutputStream -
java.io.IOException
FicheroYingoException
public void escribirFicheroToOutputStream(java.lang.String pathRelativoFichero,
java.io.OutputStream miOutputStream)
throws java.io.IOException,
FicheroYingoException
escribirFicheroToOutputStream in interface UtilFicheropathRelativoFichero - miOutputStream -
java.io.IOException
FicheroYingoException
public java.lang.String escribirFichero(java.io.InputStream miInputStream,
java.lang.String pathRelativoFichero)
throws java.io.IOException,
FicheroYingoException
escribirFichero in interface UtilFicheromiInputStream - pathRelativoFichero -
java.io.IOException
FicheroYingoException
public java.lang.String escribirFicheroDeString(java.lang.String cadenaFichero,
java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws java.io.IOException,
FicheroYingoException
escribirFicheroDeString in interface UtilFicherocadenaFichero - pathRelativo - nombreFichero -
java.io.IOException
FicheroYingoException
public java.lang.String escribirFichero(java.io.InputStream miInputStream,
java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws java.io.IOException,
FicheroYingoException
escribirFichero in interface UtilFicheroFicheroYingoException
java.io.IOException
protected void escribir(java.io.InputStream miInputStream,
java.io.OutputStream miOutputStream)
throws java.io.IOException
miInputStream - miOutputStream -
java.io.IOException
public java.lang.String crearZip(java.lang.String[] nombreFicheros,
java.lang.String[] destinoFicheros)
throws java.lang.Exception
crearZip in interface UtilFicheronombreFicheros - destinoFicheros -
java.lang.Exception
public java.lang.String obtenerStringDeFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws java.io.IOException,
FicheroYingoException
obtenerStringDeFichero in interface UtilFicheropathRelativo - nombreFichero -
java.io.IOException
FicheroYingoException
public java.lang.String obtenerStringDeFichero(java.lang.String pathRelativoFichero)
throws java.io.IOException,
FicheroYingoException
obtenerStringDeFichero in interface UtilFicheropathRelativoFichero -
java.io.IOException
FicheroYingoException
public java.io.InputStream obtenerInputStreamFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws java.io.FileNotFoundException,
FicheroYingoException
obtenerInputStreamFichero in interface UtilFicheropathRelativo - nombreFichero -
java.io.FileNotFoundException
FicheroYingoException
public java.io.InputStream obtenerInputStreamFichero(java.lang.String pathRelativoFichero)
throws java.io.FileNotFoundException,
FicheroYingoException
obtenerInputStreamFichero in interface UtilFicheropathRelativo - nombreFichero -
java.io.FileNotFoundException
FicheroYingoException
public java.lang.String obtenerMimeFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws FicheroYingoException
obtenerMimeFichero in interface UtilFicheropathRelativo - nombreFichero -
FicheroYingoException
public java.lang.String obtenerMimeFichero(java.lang.String pathRelativoFichero)
throws FicheroYingoException
obtenerMimeFichero in interface UtilFicheropathRelativoFichero -
FicheroYingoException
java.io.File obtenerFile(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws FicheroYingoException
pathRelativo - nombreFichero -
FicheroYingoException
public boolean esDirectorioVacio(java.lang.String pathRelativoFichero)
throws FicheroYingoException
esDirectorioVacio in interface UtilFicheropathRelativoFichero -
FicheroYingoException
public boolean esDirectorioVacio(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws FicheroYingoException
esDirectorioVacio in interface UtilFicheropathRelativo - nombreFichero -
FicheroYingoException
public boolean esFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws FicheroYingoException
esFichero in interface UtilFicheropathRelativo - nombreFichero -
FicheroYingoException
public boolean esFichero(java.lang.String pathRelativoFichero)
throws FicheroYingoException
esFichero in interface UtilFicheropathRelativoFichero -
FicheroYingoException
public java.lang.Long obtenerTamanoFichero(java.lang.String pathRelativoFichero)
throws java.security.NoSuchAlgorithmException,
java.io.IOException,
FicheroYingoException
obtenerTamanoFichero in interface UtilFicheropathRelativoFichero -
java.security.NoSuchAlgorithmException
java.io.IOException
FicheroYingoException
public java.lang.Long obtenerTamanoFichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws java.security.NoSuchAlgorithmException,
java.io.IOException,
FicheroYingoException
obtenerTamanoFichero in interface UtilFicheropathRelativo - nombreFichero -
java.security.NoSuchAlgorithmException
java.io.IOException
FicheroYingoException
private java.lang.String obtenerResumenCriptografico(java.lang.String pathRelativo,
java.lang.String nombreFichero,
java.lang.String digest)
throws java.security.NoSuchAlgorithmException,
java.io.IOException,
FicheroYingoException
pathRelativo - nombreFichero -
java.security.NoSuchAlgorithmException
java.io.IOException
FicheroYingoException
private java.lang.String obtenerResumenCriptograficoBase64(java.lang.String pathRelativo,
java.lang.String nombreFichero,
java.lang.String digest)
throws java.security.NoSuchAlgorithmException,
java.io.IOException,
FicheroYingoException
pathRelativo - nombreFichero -
java.security.NoSuchAlgorithmException
java.io.IOException
FicheroYingoExceptionpublic java.lang.String getPathIntermedio()
getPathIntermedio in interface UtilFicheropublic void setPathIntermedio(java.lang.String pathIntermedio)
setPathIntermedio in interface UtilFicheropathIntermedio - the pathIntermedio to set
public java.lang.String obtenerMD5Fichero(java.lang.String pathRelativoFichero)
throws java.security.NoSuchAlgorithmException,
java.io.IOException,
FicheroYingoException
obtenerMD5Fichero in interface UtilFicheropathRelativoFichero -
java.security.NoSuchAlgorithmException
java.io.IOException
FicheroYingoException
FicheroYingoException
public java.lang.String obtenerMD5Fichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws java.security.NoSuchAlgorithmException,
java.io.IOException,
FicheroYingoException
obtenerMD5Fichero in interface UtilFicheropathRelativo - nombreFichero -
java.security.NoSuchAlgorithmException
java.io.IOException
FicheroYingoException
public java.lang.String obtenerSHA1Fichero(java.lang.String pathRelativoFichero)
throws java.security.NoSuchAlgorithmException,
java.io.IOException,
FicheroYingoException
obtenerSHA1Fichero in interface UtilFicheropathRelativoFichero -
java.security.NoSuchAlgorithmException
java.io.IOException
FicheroYingoException
FicheroYingoException
public java.lang.String obtenerSHA1FicheroBase64(java.lang.String pathRelativoFichero)
throws java.security.NoSuchAlgorithmException,
java.io.IOException,
FicheroYingoException
obtenerSHA1FicheroBase64 in interface UtilFicheropathRelativoFichero -
java.security.NoSuchAlgorithmException
java.io.IOException
FicheroYingoException
FicheroYingoException
public java.lang.String obtenerSHA1Fichero(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws java.security.NoSuchAlgorithmException,
java.io.IOException,
FicheroYingoException
obtenerSHA1Fichero in interface UtilFicheropathRelativo - nombreFichero -
java.security.NoSuchAlgorithmException
java.io.IOException
FicheroYingoException
public java.lang.String obtenerSHA1FicheroBase64(java.lang.String pathRelativo,
java.lang.String nombreFichero)
throws java.security.NoSuchAlgorithmException,
java.io.IOException,
FicheroYingoException
obtenerSHA1FicheroBase64 in interface UtilFicheropathRelativo - nombreFichero -
java.security.NoSuchAlgorithmException
java.io.IOException
FicheroYingoException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||